#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
#![allow(unused_imports)]
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(clippy::unnecessary_cast)]
use crate::*;
use core::option::Option;
use core::ops::{Deref, DerefMut};
#[cfg(feature = "std")]
use std::io::{Read, Write};
use xdrs::*;
#[cfg(feature = "serde")]
use ::serde::{{Serialize, Deserialize}};
#[allow(non_camel_case_types)]
pub trait SCP_Control_SCP_Control1: Send + Sync {
fn scp_control_null(&self) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<()>, ::thruput_rpc_api::ProgramError>> + Send;
fn scp_control_nominate(&self, arg0 : SCPSlotIndex, arg1 : SCPValue, arg2 : SCPValue) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<bool>, ::thruput_rpc_api::ProgramError>> + Send;
fn scp_control_stop_nomination(&self, arg0 : SCPSlotIndex) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<()>, ::thruput_rpc_api::ProgramError>> + Send;
fn scp_control_update_local_quorum_set(&self, arg0 : SCPQuorumSet) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<()>, ::thruput_rpc_api::ProgramError>> + Send;
fn scp_control_received_envelope(&self, arg0 : SCPEnvelope) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<()>, ::thruput_rpc_api::ProgramError>> + Send;
fn scp_control_set_state_from_envelope(&self, arg0 : SCPSlotIndex, arg1 : SCPEnvelope) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<()>, ::thruput_rpc_api::ProgramError>> + Send;
fn scp_control_set_qset(&self, arg0 : SCPQuorumSet) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<SCPOptQuorumSet>, ::thruput_rpc_api::ProgramError>> + Send;
fn scp_control_get_qset(&self, arg0 : SCPHash) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<SCPOptQuorumSet>, ::thruput_rpc_api::ProgramError>> + Send;
fn scp_control_remove_qset(&self, arg0 : SCPHash) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<SCPOptQuorumSet>, ::thruput_rpc_api::ProgramError>> + Send;
fn scp_control_set_lowest_non_externalized_slot(&self, arg0 : SCPSlotIndex) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<()>, ::thruput_rpc_api::ProgramError>> + Send;
}
#[allow(non_camel_case_types)]
pub struct SCP_Control_SCP_Control1_Dispatcher<__Handler> {
inner: Box<__Handler>,
}
impl<__Handler: SCP_Control_SCP_Control1> SCP_Control_SCP_Control1_Dispatcher<__Handler> {
pub fn new(inner: Box<__Handler>) -> Self {
Self { inner }
}
}
#[async_trait::async_trait]
impl<__Handler: SCP_Control_SCP_Control1> ::thruput_rpc_api::RpcHandler for SCP_Control_SCP_Control1_Dispatcher<__Handler> {
fn prog_vers(&self) -> ::thruput_rpc_api::ProgVers {
::thruput_rpc_api::ProgVers::new(0x9aa93003, 1)
}
async fn dispatch(&self, proc: u32, data: &[u8]) -> Result<Vec<u8>, ::thruput_rpc_api::RpcError> {
match proc {
0 => {
let args: () =
xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
let res = self.inner.scp_control_null().await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
}
10 => {
let args: (SCPSlotIndex, SCPValue, SCPValue, ) =
xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
let res = self.inner.scp_control_nominate(args.0, args.1, args.2).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
}
20 => {
let args: (SCPSlotIndex, ) =
xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
let res = self.inner.scp_control_stop_nomination(args.0).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
}
100 => {
let args: (SCPQuorumSet, ) =
xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
let res = self.inner.scp_control_update_local_quorum_set(args.0).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
}
200 => {
let args: (SCPEnvelope, ) =
xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
let res = self.inner.scp_control_received_envelope(args.0).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
}
201 => {
let args: (SCPSlotIndex, SCPEnvelope, ) =
xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
let res = self.inner.scp_control_set_state_from_envelope(args.0, args.1).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
}
300 => {
let args: (SCPQuorumSet, ) =
xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
let res = self.inner.scp_control_set_qset(args.0).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
}
301 => {
let args: (SCPHash, ) =
xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
let res = self.inner.scp_control_get_qset(args.0).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
}
302 => {
let args: (SCPHash, ) =
xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
let res = self.inner.scp_control_remove_qset(args.0).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
}
400 => {
let args: (SCPSlotIndex, ) =
xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
let res = self.inner.scp_control_set_lowest_non_externalized_slot(args.0).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
}
_ => Err(::thruput_rpc_api::RpcError::InvalidProcedure),
}
}
}
#[derive(Clone)]
pub struct SCP_Control_SCP_Control1_Client {
handle: ::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>,
}
impl SCP_Control_SCP_Control1_Client {
pub fn new(handle: ::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>) -> Self {
Self { handle }
}
fn prog_vers() -> ::thruput_rpc_api::ProgVers {
::thruput_rpc_api::ProgVers::new(0x9aa93003, 1)
}
pub async fn scp_control_null(&self) -> Result<(), ::thruput_rpc_api::RpcError> {
let mut call = self.handle.call_buf();
call.append_with(|buf| {
let mut w = xdrs::txs::buf_writer::BufWriter::from(::core::mem::take(buf));
let r = xdrs::write_xdr(&(), &mut w);
*buf = w.into();
r
}).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
let mut out = ::core::option::Option::None;
let mut decode = |reply: &[u8]| -> ::core::result::Result<(), ::thruput_rpc_api::RpcError> {
out = ::core::option::Option::Some(xdrs::txs::decode(reply).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?);
Ok(())
};
unsafe { self.handle.send_call_decoded(Self::prog_vers(), 0, call, &mut decode) }.await?;
out.ok_or(::thruput_rpc_api::RpcError::SystemError)
}
pub async fn scp_control_nominate(&self, arg0 : &(impl xdrs::EncodesAs<SCPSlotIndex> + ?Sized), arg1 : &(impl xdrs::EncodesAs<SCPValue> + ?Sized), arg2 : &(impl xdrs::EncodesAs<SCPValue> + ?Sized)) -> Result<bool, ::thruput_rpc_api::RpcError> {
let mut call = self.handle.call_buf();
call.append_with(|buf| {
let mut w = xdrs::txs::buf_writer::BufWriter::from(::core::mem::take(buf));
let r = xdrs::write_xdr(&(arg0, arg1, arg2), &mut w);
*buf = w.into();
r
}).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
let mut out = ::core::option::Option::None;
let mut decode = |reply: &[u8]| -> ::core::result::Result<(), ::thruput_rpc_api::RpcError> {
out = ::core::option::Option::Some(xdrs::txs::decode(reply).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?);
Ok(())
};
unsafe { self.handle.send_call_decoded(Self::prog_vers(), 10, call, &mut decode) }.await?;
out.ok_or(::thruput_rpc_api::RpcError::SystemError)
}
pub async fn scp_control_stop_nomination(&self, arg0 : &(impl xdrs::EncodesAs<SCPSlotIndex> + ?Sized)) -> Result<(), ::thruput_rpc_api::RpcError> {
let mut call = self.handle.call_buf();
call.append_with(|buf| {
let mut w = xdrs::txs::buf_writer::BufWriter::from(::core::mem::take(buf));
let r = xdrs::write_xdr(&(arg0), &mut w);
*buf = w.into();
r
}).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
let mut out = ::core::option::Option::None;
let mut decode = |reply: &[u8]| -> ::core::result::Result<(), ::thruput_rpc_api::RpcError> {
out = ::core::option::Option::Some(xdrs::txs::decode(reply).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?);
Ok(())
};
unsafe { self.handle.send_call_decoded(Self::prog_vers(), 20, call, &mut decode) }.await?;
out.ok_or(::thruput_rpc_api::RpcError::SystemError)
}
pub async fn scp_control_update_local_quorum_set(&self, arg0 : &(impl xdrs::EncodesAs<SCPQuorumSet> + ?Sized)) -> Result<(), ::thruput_rpc_api::RpcError> {
let mut call = self.handle.call_buf();
call.append_with(|buf| {
let mut w = xdrs::txs::buf_writer::BufWriter::from(::core::mem::take(buf));
let r = xdrs::write_xdr(&(arg0), &mut w);
*buf = w.into();
r
}).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
let mut out = ::core::option::Option::None;
let mut decode = |reply: &[u8]| -> ::core::result::Result<(), ::thruput_rpc_api::RpcError> {
out = ::core::option::Option::Some(xdrs::txs::decode(reply).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?);
Ok(())
};
unsafe { self.handle.send_call_decoded(Self::prog_vers(), 100, call, &mut decode) }.await?;
out.ok_or(::thruput_rpc_api::RpcError::SystemError)
}
pub async fn scp_control_received_envelope(&self, arg0 : &(impl xdrs::EncodesAs<SCPEnvelope> + ?Sized)) -> Result<(), ::thruput_rpc_api::RpcError> {
let mut call = self.handle.call_buf();
call.append_with(|buf| {
let mut w = xdrs::txs::buf_writer::BufWriter::from(::core::mem::take(buf));
let r = xdrs::write_xdr(&(arg0), &mut w);
*buf = w.into();
r
}).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
let mut out = ::core::option::Option::None;
let mut decode = |reply: &[u8]| -> ::core::result::Result<(), ::thruput_rpc_api::RpcError> {
out = ::core::option::Option::Some(xdrs::txs::decode(reply).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?);
Ok(())
};
unsafe { self.handle.send_call_decoded(Self::prog_vers(), 200, call, &mut decode) }.await?;
out.ok_or(::thruput_rpc_api::RpcError::SystemError)
}
pub async fn scp_control_set_state_from_envelope(&self, arg0 : &(impl xdrs::EncodesAs<SCPSlotIndex> + ?Sized), arg1 : &(impl xdrs::EncodesAs<SCPEnvelope> + ?Sized)) -> Result<(), ::thruput_rpc_api::RpcError> {
let mut call = self.handle.call_buf();
call.append_with(|buf| {
let mut w = xdrs::txs::buf_writer::BufWriter::from(::core::mem::take(buf));
let r = xdrs::write_xdr(&(arg0, arg1), &mut w);
*buf = w.into();
r
}).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
let mut out = ::core::option::Option::None;
let mut decode = |reply: &[u8]| -> ::core::result::Result<(), ::thruput_rpc_api::RpcError> {
out = ::core::option::Option::Some(xdrs::txs::decode(reply).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?);
Ok(())
};
unsafe { self.handle.send_call_decoded(Self::prog_vers(), 201, call, &mut decode) }.await?;
out.ok_or(::thruput_rpc_api::RpcError::SystemError)
}
pub async fn scp_control_set_qset(&self, arg0 : &(impl xdrs::EncodesAs<SCPQuorumSet> + ?Sized)) -> Result<SCPOptQuorumSet, ::thruput_rpc_api::RpcError> {
let mut call = self.handle.call_buf();
call.append_with(|buf| {
let mut w = xdrs::txs::buf_writer::BufWriter::from(::core::mem::take(buf));
let r = xdrs::write_xdr(&(arg0), &mut w);
*buf = w.into();
r
}).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
let mut out = ::core::option::Option::None;
let mut decode = |reply: &[u8]| -> ::core::result::Result<(), ::thruput_rpc_api::RpcError> {
out = ::core::option::Option::Some(xdrs::txs::decode(reply).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?);
Ok(())
};
unsafe { self.handle.send_call_decoded(Self::prog_vers(), 300, call, &mut decode) }.await?;
out.ok_or(::thruput_rpc_api::RpcError::SystemError)
}
pub async fn scp_control_get_qset(&self, arg0 : &(impl xdrs::EncodesAs<SCPHash> + ?Sized)) -> Result<SCPOptQuorumSet, ::thruput_rpc_api::RpcError> {
let mut call = self.handle.call_buf();
call.append_with(|buf| {
let mut w = xdrs::txs::buf_writer::BufWriter::from(::core::mem::take(buf));
let r = xdrs::write_xdr(&(arg0), &mut w);
*buf = w.into();
r
}).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
let mut out = ::core::option::Option::None;
let mut decode = |reply: &[u8]| -> ::core::result::Result<(), ::thruput_rpc_api::RpcError> {
out = ::core::option::Option::Some(xdrs::txs::decode(reply).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?);
Ok(())
};
unsafe { self.handle.send_call_decoded(Self::prog_vers(), 301, call, &mut decode) }.await?;
out.ok_or(::thruput_rpc_api::RpcError::SystemError)
}
pub async fn scp_control_remove_qset(&self, arg0 : &(impl xdrs::EncodesAs<SCPHash> + ?Sized)) -> Result<SCPOptQuorumSet, ::thruput_rpc_api::RpcError> {
let mut call = self.handle.call_buf();
call.append_with(|buf| {
let mut w = xdrs::txs::buf_writer::BufWriter::from(::core::mem::take(buf));
let r = xdrs::write_xdr(&(arg0), &mut w);
*buf = w.into();
r
}).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
let mut out = ::core::option::Option::None;
let mut decode = |reply: &[u8]| -> ::core::result::Result<(), ::thruput_rpc_api::RpcError> {
out = ::core::option::Option::Some(xdrs::txs::decode(reply).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?);
Ok(())
};
unsafe { self.handle.send_call_decoded(Self::prog_vers(), 302, call, &mut decode) }.await?;
out.ok_or(::thruput_rpc_api::RpcError::SystemError)
}
pub async fn scp_control_set_lowest_non_externalized_slot(&self, arg0 : &(impl xdrs::EncodesAs<SCPSlotIndex> + ?Sized)) -> Result<(), ::thruput_rpc_api::RpcError> {
let mut call = self.handle.call_buf();
call.append_with(|buf| {
let mut w = xdrs::txs::buf_writer::BufWriter::from(::core::mem::take(buf));
let r = xdrs::write_xdr(&(arg0), &mut w);
*buf = w.into();
r
}).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
let mut out = ::core::option::Option::None;
let mut decode = |reply: &[u8]| -> ::core::result::Result<(), ::thruput_rpc_api::RpcError> {
out = ::core::option::Option::Some(xdrs::txs::decode(reply).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?);
Ok(())
};
unsafe { self.handle.send_call_decoded(Self::prog_vers(), 400, call, &mut decode) }.await?;
out.ok_or(::thruput_rpc_api::RpcError::SystemError)
}
}
impl From<::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>> for SCP_Control_SCP_Control1_Client {
fn from(handle: ::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>) -> Self {
Self::new(handle)
}
}