#![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}};
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(transparent))]
#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
#[derive(schemars::JsonSchema)]
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[derive(Copy)]
#[repr(transparent)]
pub struct AuthErrorCode(pub i32);
impl AuthErrorCode {
pub const kAuthSuccess: Self = Self(0);
pub const kAuthFailed: Self = Self(1);
pub const kAuthStaleBlockHeight: Self = Self(2);
pub const kAuthInternal: Self = Self(3);
}
impl From<i32> for AuthErrorCode {
fn from(v: i32) -> Self {
Self(v)
}
}
#[cfg(feature = "std")]
impl core::fmt::Display for AuthErrorCode {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self.0 {
x if x == Self::kAuthSuccess.0 => {
write!(f, "AuthErrorCode::kAuthSuccess")
},
x if x == Self::kAuthFailed.0 => {
write!(f, "AuthErrorCode::kAuthFailed")
},
x if x == Self::kAuthStaleBlockHeight.0 => {
write!(f, "AuthErrorCode::kAuthStaleBlockHeight")
},
x if x == Self::kAuthInternal.0 => {
write!(f, "AuthErrorCode::kAuthInternal")
},
_ => {
write!(f, "AuthErrorCode({})", self.0)
}
}
}
}
pub type AuthErrorCodeBatch = VecM::<AuthErrorCode>;
#[allow(non_camel_case_types)]
pub trait AuthMempool_AuthMempool1: Send + Sync {
fn authmempool_verify_transactions(&self, arg0 : BlockHeight, arg1 : SignedTransactionBatch) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<AuthErrorCodeBatch>, ::thruput_rpc_api::ProgramError>> + Send;
fn authmempool_verify_batch(&self, arg0 : BlockHeight, arg1 : SignedTransactionBatch) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<AuthErrorCode>, ::thruput_rpc_api::ProgramError>> + Send;
}
#[allow(non_camel_case_types)]
pub struct AuthMempool_AuthMempool1_Dispatcher<__Handler> {
inner: Box<__Handler>,
}
impl<__Handler: AuthMempool_AuthMempool1> AuthMempool_AuthMempool1_Dispatcher<__Handler> {
pub fn new(inner: Box<__Handler>) -> Self {
Self { inner }
}
}
#[async_trait::async_trait]
impl<__Handler: AuthMempool_AuthMempool1> ::thruput_rpc_api::RpcHandler for AuthMempool_AuthMempool1_Dispatcher<__Handler> {
fn prog_vers(&self) -> ::thruput_rpc_api::ProgVers {
::thruput_rpc_api::ProgVers::new(0x8aa87aa7, 1)
}
async fn dispatch(&self, proc: u32, data: &[u8]) -> Result<Vec<u8>, ::thruput_rpc_api::RpcError> {
match proc {
2 => {
let args: (BlockHeight, SignedTransactionBatch, ) =
xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
let res = self.inner.authmempool_verify_transactions(args.0, args.1).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
}
3 => {
let args: (BlockHeight, SignedTransactionBatch, ) =
xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
let res = self.inner.authmempool_verify_batch(args.0, args.1).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 AuthMempool_AuthMempool1_Client {
handle: ::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>,
}
impl AuthMempool_AuthMempool1_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(0x8aa87aa7, 1)
}
pub async fn authmempool_verify_transactions(&self, arg0 : &(impl xdrs::EncodesAs<BlockHeight> + ?Sized), arg1 : &(impl xdrs::EncodesAs<SignedTransactionBatch> + ?Sized)) -> Result<AuthErrorCodeBatch, ::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(), 2, call, &mut decode) }.await?;
out.ok_or(::thruput_rpc_api::RpcError::SystemError)
}
pub async fn authmempool_verify_batch(&self, arg0 : &(impl xdrs::EncodesAs<BlockHeight> + ?Sized), arg1 : &(impl xdrs::EncodesAs<SignedTransactionBatch> + ?Sized)) -> Result<AuthErrorCode, ::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(), 3, call, &mut decode) }.await?;
out.ok_or(::thruput_rpc_api::RpcError::SystemError)
}
}
impl From<::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>> for AuthMempool_AuthMempool1_Client {
fn from(handle: ::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>) -> Self {
Self::new(handle)
}
}
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
#[derive(schemars::JsonSchema)]
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[repr(C)]
pub struct KeyChange {
pub address: ContractAddress,
pub auth_data: Option<AddressAuthData>,
}
pub type KeyChangeBatch = VecM::<KeyChange>;
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
#[derive(schemars::JsonSchema)]
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[repr(C)]
pub struct KeyChangeChunk {
pub height: BlockHeight,
pub chunk_index: u32,
pub chunk_count: u32,
pub changes: VecM<KeyChange>,
}
#[allow(non_camel_case_types)]
pub trait AuthDB_AuthDB1: Send + Sync {
fn authdb_forward_key_changes_chunk(&self, arg0 : KeyChangeChunk) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<()>, ::thruput_rpc_api::ProgramError>> + Send;
}
#[allow(non_camel_case_types)]
pub struct AuthDB_AuthDB1_Dispatcher<__Handler> {
inner: Box<__Handler>,
}
impl<__Handler: AuthDB_AuthDB1> AuthDB_AuthDB1_Dispatcher<__Handler> {
pub fn new(inner: Box<__Handler>) -> Self {
Self { inner }
}
}
#[async_trait::async_trait]
impl<__Handler: AuthDB_AuthDB1> ::thruput_rpc_api::RpcHandler for AuthDB_AuthDB1_Dispatcher<__Handler> {
fn prog_vers(&self) -> ::thruput_rpc_api::ProgVers {
::thruput_rpc_api::ProgVers::new(0x8aa87aa8, 1)
}
async fn dispatch(&self, proc: u32, data: &[u8]) -> Result<Vec<u8>, ::thruput_rpc_api::RpcError> {
match proc {
2 => {
let args: (KeyChangeChunk, ) =
xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
let res = self.inner.authdb_forward_key_changes_chunk(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 AuthDB_AuthDB1_Client {
handle: ::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>,
}
impl AuthDB_AuthDB1_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(0x8aa87aa8, 1)
}
pub async fn authdb_forward_key_changes_chunk(&self, arg0 : &(impl xdrs::EncodesAs<KeyChangeChunk> + ?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(), 2, call, &mut decode) }.await?;
out.ok_or(::thruput_rpc_api::RpcError::SystemError)
}
}
impl From<::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>> for AuthDB_AuthDB1_Client {
fn from(handle: ::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>) -> Self {
Self::new(handle)
}
}
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(transparent))]
#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
#[derive(schemars::JsonSchema)]
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[derive(Copy)]
#[repr(transparent)]
pub struct DBAuthError(pub i32);
impl DBAuthError {
pub const kDBAuthSuccess: Self = Self(0);
pub const kDBAuthNotFound: Self = Self(1);
pub const kDBAuthStaleBlockHeight: Self = Self(2);
pub const kDBAuthInternal: Self = Self(3);
}
impl From<i32> for DBAuthError {
fn from(v: i32) -> Self {
Self(v)
}
}
#[cfg(feature = "std")]
impl core::fmt::Display for DBAuthError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self.0 {
x if x == Self::kDBAuthSuccess.0 => {
write!(f, "DBAuthError::kDBAuthSuccess")
},
x if x == Self::kDBAuthNotFound.0 => {
write!(f, "DBAuthError::kDBAuthNotFound")
},
x if x == Self::kDBAuthStaleBlockHeight.0 => {
write!(f, "DBAuthError::kDBAuthStaleBlockHeight")
},
x if x == Self::kDBAuthInternal.0 => {
write!(f, "DBAuthError::kDBAuthInternal")
},
_ => {
write!(f, "DBAuthError({})", self.0)
}
}
}
}
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
#[derive(schemars::JsonSchema)]
#[repr(i32)]
#[non_exhaustive]
pub enum DBAuthResult {
kDBAuthSuccess { auth_data: AddressAuthData } = DBAuthError::kDBAuthSuccess.0 as i32,
#[xdr(default_variant)] Default { error: i32 },
}
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(transparent))]
#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
#[derive(schemars::JsonSchema)]
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[derive(Copy)]
#[repr(transparent)]
pub struct DBAuthIntroOutcome(pub i32);
impl DBAuthIntroOutcome {
pub const kIntroSuccess: Self = Self(0);
pub const kIntroFailure: Self = Self(1);
}
impl From<i32> for DBAuthIntroOutcome {
fn from(v: i32) -> Self {
Self(v)
}
}
#[cfg(feature = "std")]
impl core::fmt::Display for DBAuthIntroOutcome {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self.0 {
x if x == Self::kIntroSuccess.0 => {
write!(f, "DBAuthIntroOutcome::kIntroSuccess")
},
x if x == Self::kIntroFailure.0 => {
write!(f, "DBAuthIntroOutcome::kIntroFailure")
},
_ => {
write!(f, "DBAuthIntroOutcome({})", self.0)
}
}
}
}
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
#[derive(schemars::JsonSchema)]
#[repr(i32)]
#[non_exhaustive]
pub enum DBAuthIntroResult {
kIntroSuccess { current_height: BlockHeight } = DBAuthIntroOutcome::kIntroSuccess.0 as i32,
#[xdr(default_variant)] Default { outcome: i32 },
}
pub type DBAuthResultBatch = VecM::<DBAuthResult>;
#[allow(non_camel_case_types)]
pub trait DBAuth_DBAuth1: Send + Sync {
fn authdb_get_auth_data(&self, arg0 : BlockHeight, arg1 : ContractAddress) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<DBAuthResult>, ::thruput_rpc_api::ProgramError>> + Send;
fn authdb_get_auth_data_batch(&self, arg0 : BlockHeight, arg1 : ContractAddressBatch) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<DBAuthResultBatch>, ::thruput_rpc_api::ProgramError>> + Send;
fn dbauth_intro(&self, arg0 : AuthCard) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<DBAuthIntroResult>, ::thruput_rpc_api::ProgramError>> + Send;
}
#[allow(non_camel_case_types)]
pub struct DBAuth_DBAuth1_Dispatcher<__Handler> {
inner: Box<__Handler>,
}
impl<__Handler: DBAuth_DBAuth1> DBAuth_DBAuth1_Dispatcher<__Handler> {
pub fn new(inner: Box<__Handler>) -> Self {
Self { inner }
}
}
#[async_trait::async_trait]
impl<__Handler: DBAuth_DBAuth1> ::thruput_rpc_api::RpcHandler for DBAuth_DBAuth1_Dispatcher<__Handler> {
fn prog_vers(&self) -> ::thruput_rpc_api::ProgVers {
::thruput_rpc_api::ProgVers::new(0x8aa87aa9, 1)
}
async fn dispatch(&self, proc: u32, data: &[u8]) -> Result<Vec<u8>, ::thruput_rpc_api::RpcError> {
match proc {
0 => {
let args: (BlockHeight, ContractAddress, ) =
xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
let res = self.inner.authdb_get_auth_data(args.0, args.1).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
}
1 => {
let args: (BlockHeight, ContractAddressBatch, ) =
xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
let res = self.inner.authdb_get_auth_data_batch(args.0, args.1).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
}
2 => {
let args: (AuthCard, ) =
xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
let res = self.inner.dbauth_intro(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 DBAuth_DBAuth1_Client {
handle: ::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>,
}
impl DBAuth_DBAuth1_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(0x8aa87aa9, 1)
}
pub async fn authdb_get_auth_data(&self, arg0 : &(impl xdrs::EncodesAs<BlockHeight> + ?Sized), arg1 : &(impl xdrs::EncodesAs<ContractAddress> + ?Sized)) -> Result<DBAuthResult, ::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(), 0, call, &mut decode) }.await?;
out.ok_or(::thruput_rpc_api::RpcError::SystemError)
}
pub async fn authdb_get_auth_data_batch(&self, arg0 : &(impl xdrs::EncodesAs<BlockHeight> + ?Sized), arg1 : &(impl xdrs::EncodesAs<ContractAddressBatch> + ?Sized)) -> Result<DBAuthResultBatch, ::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(), 1, call, &mut decode) }.await?;
out.ok_or(::thruput_rpc_api::RpcError::SystemError)
}
pub async fn dbauth_intro(&self, arg0 : &(impl xdrs::EncodesAs<AuthCard> + ?Sized)) -> Result<DBAuthIntroResult, ::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(), 2, call, &mut decode) }.await?;
out.ok_or(::thruput_rpc_api::RpcError::SystemError)
}
}
impl From<::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>> for DBAuth_DBAuth1_Client {
fn from(handle: ::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>) -> Self {
Self::new(handle)
}
}
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(transparent))]
#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
#[derive(schemars::JsonSchema)]
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[derive(Copy)]
#[repr(transparent)]
pub struct IntroAuthOutcome(pub i32);
impl IntroAuthOutcome {
pub const kSuccess: Self = Self(0);
pub const kFailure: Self = Self(1);
}
impl From<i32> for IntroAuthOutcome {
fn from(v: i32) -> Self {
Self(v)
}
}
#[cfg(feature = "std")]
impl core::fmt::Display for IntroAuthOutcome {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self.0 {
x if x == Self::kSuccess.0 => {
write!(f, "IntroAuthOutcome::kSuccess")
},
x if x == Self::kFailure.0 => {
write!(f, "IntroAuthOutcome::kFailure")
},
_ => {
write!(f, "IntroAuthOutcome({})", self.0)
}
}
}
}
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
#[derive(schemars::JsonSchema)]
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[repr(C)]
pub struct MempoolAuthIntroSuccess {
pub shards: VecM<ShardCard>,
pub network_hash: NetworkHash,
}
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
#[derive(schemars::JsonSchema)]
#[repr(i32)]
#[non_exhaustive]
pub enum IntroAuthResult {
kSuccess { success: MempoolAuthIntroSuccess } = IntroAuthOutcome::kSuccess.0 as i32,
#[xdr(default_variant)] Default { outcome: i32 },
}
#[allow(non_camel_case_types)]
pub trait MempoolAuth_MempoolAuth1: Send + Sync {
fn mempoolauth_intro_auth(&self, arg0 : AuthCard) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<IntroAuthResult>, ::thruput_rpc_api::ProgramError>> + Send;
fn mempoolauth_auth_data_changed_chunk(&self, arg0 : KeyChangeChunk) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<()>, ::thruput_rpc_api::ProgramError>> + Send;
fn mempoolauth_get_auth_info(&self, arg0 : ProtocolCommit) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<IntroAuthResult>, ::thruput_rpc_api::ProgramError>> + Send;
}
#[allow(non_camel_case_types)]
pub struct MempoolAuth_MempoolAuth1_Dispatcher<__Handler> {
inner: Box<__Handler>,
}
impl<__Handler: MempoolAuth_MempoolAuth1> MempoolAuth_MempoolAuth1_Dispatcher<__Handler> {
pub fn new(inner: Box<__Handler>) -> Self {
Self { inner }
}
}
#[async_trait::async_trait]
impl<__Handler: MempoolAuth_MempoolAuth1> ::thruput_rpc_api::RpcHandler for MempoolAuth_MempoolAuth1_Dispatcher<__Handler> {
fn prog_vers(&self) -> ::thruput_rpc_api::ProgVers {
::thruput_rpc_api::ProgVers::new(0x8aa87aaa, 1)
}
async fn dispatch(&self, proc: u32, data: &[u8]) -> Result<Vec<u8>, ::thruput_rpc_api::RpcError> {
match proc {
0 => {
let args: (AuthCard, ) =
xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
let res = self.inner.mempoolauth_intro_auth(args.0).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
}
2 => {
let args: (KeyChangeChunk, ) =
xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
let res = self.inner.mempoolauth_auth_data_changed_chunk(args.0).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
}
3 => {
let args: (ProtocolCommit, ) =
xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
let res = self.inner.mempoolauth_get_auth_info(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 MempoolAuth_MempoolAuth1_Client {
handle: ::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>,
}
impl MempoolAuth_MempoolAuth1_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(0x8aa87aaa, 1)
}
pub async fn mempoolauth_intro_auth(&self, arg0 : &(impl xdrs::EncodesAs<AuthCard> + ?Sized)) -> Result<IntroAuthResult, ::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(), 0, call, &mut decode) }.await?;
out.ok_or(::thruput_rpc_api::RpcError::SystemError)
}
pub async fn mempoolauth_auth_data_changed_chunk(&self, arg0 : &(impl xdrs::EncodesAs<KeyChangeChunk> + ?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(), 2, call, &mut decode) }.await?;
out.ok_or(::thruput_rpc_api::RpcError::SystemError)
}
pub async fn mempoolauth_get_auth_info(&self, arg0 : &(impl xdrs::EncodesAs<ProtocolCommit> + ?Sized)) -> Result<IntroAuthResult, ::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(), 3, call, &mut decode) }.await?;
out.ok_or(::thruput_rpc_api::RpcError::SystemError)
}
}
impl From<::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>> for MempoolAuth_MempoolAuth1_Client {
fn from(handle: ::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>) -> Self {
Self::new(handle)
}
}
impl DBAuthResult {
#[allow(clippy::match_single_binding)]
pub fn error(&self) -> DBAuthError {
match self {
DBAuthResult::Default{ error } => (*error).into(),
_ => (unsafe { *(self as *const Self as *const i32) }).into(),
}
}
}
impl DBAuthIntroResult {
#[allow(clippy::match_single_binding)]
pub fn outcome(&self) -> DBAuthIntroOutcome {
match self {
DBAuthIntroResult::Default{ outcome } => (*outcome).into(),
_ => (unsafe { *(self as *const Self as *const i32) }).into(),
}
}
}
impl IntroAuthResult {
#[allow(clippy::match_single_binding)]
pub fn outcome(&self) -> IntroAuthOutcome {
match self {
IntroAuthResult::Default{ outcome } => (*outcome).into(),
_ => (unsafe { *(self as *const Self as *const i32) }).into(),
}
}
}