1pub mod attack {
2 tonic::include_proto!("attack");
3}
4
5use attack::attack_service_client::AttackServiceClient;
6use attack::{ReportValidatorInfoRequest, DelayForBlockRequest, ReportDutyRequest, ModifyBlockRequest};
7
8pub struct AttackClient {
9 client: AttackServiceClient<tonic::transport::Channel>,
10}
11
12impl AttackClient {
13 pub async fn connect(endpoint: &str) -> Result<Self, Box<dyn std::error::Error>> {
14 let client = AttackServiceClient::connect(endpoint.to_string()).await?;
15 Ok(Self { client })
16 }
17
18 pub async fn report_validator_info(
19 &mut self,
20 request: ReportValidatorInfoRequest,
21 ) -> Result<tonic::Response<attack::ReportValidatorInfoResponse>, tonic::Status> {
22 self.client.report_validator_info(request).await
23 }
24
25 pub async fn delay_for_block(
26 &mut self,
27 request: DelayForBlockRequest,
28 ) -> Result<tonic::Response<attack::DelayForBlockResponse>, tonic::Status> {
29 self.client.delay_for_block(request).await
30 }
31
32 pub async fn report_duty(
33 &mut self,
34 request: ReportDutyRequest,
35 ) -> Result<tonic::Response<attack::ReportDutyResponse>, tonic::Status> {
36 self.client.report_duty(request).await
37 }
38
39 pub async fn modify_block(
40 &mut self,
41 request: ModifyBlockRequest,
42 ) -> Result<tonic::Response<attack::ModifyBlockResponse>, tonic::Status> {
43 self.client.modify_block(request).await
44 }
45}