pub mod market_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct MarketServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl MarketServiceClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> MarketServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> MarketServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
MarketServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn list_trading_pairs(
&mut self,
request: impl tonic::IntoRequest<super::ListTradingPairsRequest>,
) -> std::result::Result<
tonic::Response<super::ListTradingPairsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/monaco.api.market.MarketService/ListTradingPairs",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"monaco.api.market.MarketService",
"ListTradingPairs",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_trading_pair(
&mut self,
request: impl tonic::IntoRequest<super::GetTradingPairRequest>,
) -> std::result::Result<
tonic::Response<super::GetTradingPairResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/monaco.api.market.MarketService/GetTradingPair",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("monaco.api.market.MarketService", "GetTradingPair"),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_candles(
&mut self,
request: impl tonic::IntoRequest<super::GetCandlesRequest>,
) -> std::result::Result<
tonic::Response<super::GetCandlesResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/monaco.api.market.MarketService/GetCandles",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("monaco.api.market.MarketService", "GetCandles"),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_market_metadata(
&mut self,
request: impl tonic::IntoRequest<super::GetMarketMetadataRequest>,
) -> std::result::Result<
tonic::Response<super::GetMarketMetadataResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/monaco.api.market.MarketService/GetMarketMetadata",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"monaco.api.market.MarketService",
"GetMarketMetadata",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_open_interest(
&mut self,
request: impl tonic::IntoRequest<super::GetOpenInterestRequest>,
) -> std::result::Result<
tonic::Response<super::GetOpenInterestResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/monaco.api.market.MarketService/GetOpenInterest",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("monaco.api.market.MarketService", "GetOpenInterest"),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_funding_state(
&mut self,
request: impl tonic::IntoRequest<super::GetFundingStateRequest>,
) -> std::result::Result<
tonic::Response<super::GetFundingStateResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/monaco.api.market.MarketService/GetFundingState",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("monaco.api.market.MarketService", "GetFundingState"),
);
self.inner.unary(req, path, codec).await
}
pub async fn list_funding_history(
&mut self,
request: impl tonic::IntoRequest<super::ListFundingHistoryRequest>,
) -> std::result::Result<
tonic::Response<super::ListFundingHistoryResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/monaco.api.market.MarketService/ListFundingHistory",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"monaco.api.market.MarketService",
"ListFundingHistory",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_perp_market_config(
&mut self,
request: impl tonic::IntoRequest<super::GetPerpMarketConfigRequest>,
) -> std::result::Result<
tonic::Response<super::GetPerpMarketConfigResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/monaco.api.market.MarketService/GetPerpMarketConfig",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"monaco.api.market.MarketService",
"GetPerpMarketConfig",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_perp_market_summary(
&mut self,
request: impl tonic::IntoRequest<super::GetPerpMarketSummaryRequest>,
) -> std::result::Result<
tonic::Response<super::GetPerpMarketSummaryResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/monaco.api.market.MarketService/GetPerpMarketSummary",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"monaco.api.market.MarketService",
"GetPerpMarketSummary",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_mark_price(
&mut self,
request: impl tonic::IntoRequest<super::GetMarkPriceRequest>,
) -> std::result::Result<
tonic::Response<super::GetMarkPriceResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/monaco.api.market.MarketService/GetMarkPrice",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("monaco.api.market.MarketService", "GetMarkPrice"),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_index_price(
&mut self,
request: impl tonic::IntoRequest<super::GetIndexPriceRequest>,
) -> std::result::Result<
tonic::Response<super::GetIndexPriceResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/monaco.api.market.MarketService/GetIndexPrice",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("monaco.api.market.MarketService", "GetIndexPrice"),
);
self.inner.unary(req, path, codec).await
}
}
}
pub mod market_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait MarketService: std::marker::Send + std::marker::Sync + 'static {
async fn list_trading_pairs(
&self,
request: tonic::Request<super::ListTradingPairsRequest>,
) -> std::result::Result<
tonic::Response<super::ListTradingPairsResponse>,
tonic::Status,
>;
async fn get_trading_pair(
&self,
request: tonic::Request<super::GetTradingPairRequest>,
) -> std::result::Result<
tonic::Response<super::GetTradingPairResponse>,
tonic::Status,
>;
async fn get_candles(
&self,
request: tonic::Request<super::GetCandlesRequest>,
) -> std::result::Result<
tonic::Response<super::GetCandlesResponse>,
tonic::Status,
>;
async fn get_market_metadata(
&self,
request: tonic::Request<super::GetMarketMetadataRequest>,
) -> std::result::Result<
tonic::Response<super::GetMarketMetadataResponse>,
tonic::Status,
>;
async fn get_open_interest(
&self,
request: tonic::Request<super::GetOpenInterestRequest>,
) -> std::result::Result<
tonic::Response<super::GetOpenInterestResponse>,
tonic::Status,
>;
async fn get_funding_state(
&self,
request: tonic::Request<super::GetFundingStateRequest>,
) -> std::result::Result<
tonic::Response<super::GetFundingStateResponse>,
tonic::Status,
>;
async fn list_funding_history(
&self,
request: tonic::Request<super::ListFundingHistoryRequest>,
) -> std::result::Result<
tonic::Response<super::ListFundingHistoryResponse>,
tonic::Status,
>;
async fn get_perp_market_config(
&self,
request: tonic::Request<super::GetPerpMarketConfigRequest>,
) -> std::result::Result<
tonic::Response<super::GetPerpMarketConfigResponse>,
tonic::Status,
>;
async fn get_perp_market_summary(
&self,
request: tonic::Request<super::GetPerpMarketSummaryRequest>,
) -> std::result::Result<
tonic::Response<super::GetPerpMarketSummaryResponse>,
tonic::Status,
>;
async fn get_mark_price(
&self,
request: tonic::Request<super::GetMarkPriceRequest>,
) -> std::result::Result<
tonic::Response<super::GetMarkPriceResponse>,
tonic::Status,
>;
async fn get_index_price(
&self,
request: tonic::Request<super::GetIndexPriceRequest>,
) -> std::result::Result<
tonic::Response<super::GetIndexPriceResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct MarketServiceServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> MarketServiceServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for MarketServiceServer<T>
where
T: MarketService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/monaco.api.market.MarketService/ListTradingPairs" => {
#[allow(non_camel_case_types)]
struct ListTradingPairsSvc<T: MarketService>(pub Arc<T>);
impl<
T: MarketService,
> tonic::server::UnaryService<super::ListTradingPairsRequest>
for ListTradingPairsSvc<T> {
type Response = super::ListTradingPairsResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ListTradingPairsRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MarketService>::list_trading_pairs(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListTradingPairsSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/monaco.api.market.MarketService/GetTradingPair" => {
#[allow(non_camel_case_types)]
struct GetTradingPairSvc<T: MarketService>(pub Arc<T>);
impl<
T: MarketService,
> tonic::server::UnaryService<super::GetTradingPairRequest>
for GetTradingPairSvc<T> {
type Response = super::GetTradingPairResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetTradingPairRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MarketService>::get_trading_pair(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetTradingPairSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/monaco.api.market.MarketService/GetCandles" => {
#[allow(non_camel_case_types)]
struct GetCandlesSvc<T: MarketService>(pub Arc<T>);
impl<
T: MarketService,
> tonic::server::UnaryService<super::GetCandlesRequest>
for GetCandlesSvc<T> {
type Response = super::GetCandlesResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetCandlesRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MarketService>::get_candles(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetCandlesSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/monaco.api.market.MarketService/GetMarketMetadata" => {
#[allow(non_camel_case_types)]
struct GetMarketMetadataSvc<T: MarketService>(pub Arc<T>);
impl<
T: MarketService,
> tonic::server::UnaryService<super::GetMarketMetadataRequest>
for GetMarketMetadataSvc<T> {
type Response = super::GetMarketMetadataResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetMarketMetadataRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MarketService>::get_market_metadata(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetMarketMetadataSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/monaco.api.market.MarketService/GetOpenInterest" => {
#[allow(non_camel_case_types)]
struct GetOpenInterestSvc<T: MarketService>(pub Arc<T>);
impl<
T: MarketService,
> tonic::server::UnaryService<super::GetOpenInterestRequest>
for GetOpenInterestSvc<T> {
type Response = super::GetOpenInterestResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetOpenInterestRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MarketService>::get_open_interest(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetOpenInterestSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/monaco.api.market.MarketService/GetFundingState" => {
#[allow(non_camel_case_types)]
struct GetFundingStateSvc<T: MarketService>(pub Arc<T>);
impl<
T: MarketService,
> tonic::server::UnaryService<super::GetFundingStateRequest>
for GetFundingStateSvc<T> {
type Response = super::GetFundingStateResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetFundingStateRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MarketService>::get_funding_state(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetFundingStateSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/monaco.api.market.MarketService/ListFundingHistory" => {
#[allow(non_camel_case_types)]
struct ListFundingHistorySvc<T: MarketService>(pub Arc<T>);
impl<
T: MarketService,
> tonic::server::UnaryService<super::ListFundingHistoryRequest>
for ListFundingHistorySvc<T> {
type Response = super::ListFundingHistoryResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ListFundingHistoryRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MarketService>::list_funding_history(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListFundingHistorySvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/monaco.api.market.MarketService/GetPerpMarketConfig" => {
#[allow(non_camel_case_types)]
struct GetPerpMarketConfigSvc<T: MarketService>(pub Arc<T>);
impl<
T: MarketService,
> tonic::server::UnaryService<super::GetPerpMarketConfigRequest>
for GetPerpMarketConfigSvc<T> {
type Response = super::GetPerpMarketConfigResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetPerpMarketConfigRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MarketService>::get_perp_market_config(
&inner,
request,
)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetPerpMarketConfigSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/monaco.api.market.MarketService/GetPerpMarketSummary" => {
#[allow(non_camel_case_types)]
struct GetPerpMarketSummarySvc<T: MarketService>(pub Arc<T>);
impl<
T: MarketService,
> tonic::server::UnaryService<super::GetPerpMarketSummaryRequest>
for GetPerpMarketSummarySvc<T> {
type Response = super::GetPerpMarketSummaryResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetPerpMarketSummaryRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MarketService>::get_perp_market_summary(
&inner,
request,
)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetPerpMarketSummarySvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/monaco.api.market.MarketService/GetMarkPrice" => {
#[allow(non_camel_case_types)]
struct GetMarkPriceSvc<T: MarketService>(pub Arc<T>);
impl<
T: MarketService,
> tonic::server::UnaryService<super::GetMarkPriceRequest>
for GetMarkPriceSvc<T> {
type Response = super::GetMarkPriceResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetMarkPriceRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MarketService>::get_mark_price(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetMarkPriceSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/monaco.api.market.MarketService/GetIndexPrice" => {
#[allow(non_camel_case_types)]
struct GetIndexPriceSvc<T: MarketService>(pub Arc<T>);
impl<
T: MarketService,
> tonic::server::UnaryService<super::GetIndexPriceRequest>
for GetIndexPriceSvc<T> {
type Response = super::GetIndexPriceResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetIndexPriceRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MarketService>::get_index_price(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetIndexPriceSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for MarketServiceServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
pub const SERVICE_NAME: &str = "monaco.api.market.MarketService";
impl<T> tonic::server::NamedService for MarketServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}