1#![allow(non_camel_case_types)]
7#![allow(non_snake_case)]
8#![allow(non_upper_case_globals)]
9#![allow(unused_imports)]
10#![allow(dead_code)]
11#![allow(unused_variables)]
12#![allow(clippy::unnecessary_cast)]
13
14use crate::*;
15use core::option::Option;
16use core::ops::{Deref, DerefMut};
17
18#[cfg(feature = "std")]
19use std::io::{Read, Write};
20use xdrs::*;
21
22
23#[cfg(feature = "serde")]
24use ::serde::{{Serialize, Deserialize}};
25
26
27
28#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
29#[cfg_attr(feature = "serde", serde(transparent))]
30#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
31#[derive(schemars::JsonSchema)]
32#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
33#[derive(Copy)]
34#[repr(transparent)]
35pub struct AuthErrorCode(pub i32);
36
37impl AuthErrorCode {
38 pub const kAuthSuccess: Self = Self(0);
39 pub const kAuthFailed: Self = Self(1);
40
41 pub const kAuthStaleBlockHeight: Self = Self(2);
47
48 pub const kAuthInternal: Self = Self(3);
50}
51impl From<i32> for AuthErrorCode {
52 fn from(v: i32) -> Self {
53 Self(v)
54 }
55}
56#[cfg(feature = "std")]
57impl core::fmt::Display for AuthErrorCode {
58 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
59 match self.0 {
60 x if x == Self::kAuthSuccess.0 => {
61 write!(f, "AuthErrorCode::kAuthSuccess")
62 },
63 x if x == Self::kAuthFailed.0 => {
64 write!(f, "AuthErrorCode::kAuthFailed")
65 },
66 x if x == Self::kAuthStaleBlockHeight.0 => {
67 write!(f, "AuthErrorCode::kAuthStaleBlockHeight")
68 },
69 x if x == Self::kAuthInternal.0 => {
70 write!(f, "AuthErrorCode::kAuthInternal")
71 },
72 _ => {
73 write!(f, "AuthErrorCode({})", self.0)
74 }
75 }
76 }
77}
78
79
80pub type AuthErrorCodeBatch = VecM::<AuthErrorCode>;
81
82
83#[allow(non_camel_case_types)]
87pub 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;
93 fn authmempool_verify_batch(&self, arg0 : BlockHeight, arg1 : SignedTransactionBatch) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<AuthErrorCode>, ::thruput_rpc_api::ProgramError>> + Send;
100}
101
102
103#[allow(non_camel_case_types)]
104pub struct AuthMempool_AuthMempool1_Dispatcher<__Handler> {
105 inner: Box<__Handler>,
106}
107
108impl<__Handler: AuthMempool_AuthMempool1> AuthMempool_AuthMempool1_Dispatcher<__Handler> {
109 pub fn new(inner: Box<__Handler>) -> Self {
110 Self { inner }
111 }
112}
113
114#[async_trait::async_trait]
115impl<__Handler: AuthMempool_AuthMempool1> ::thruput_rpc_api::RpcHandler for AuthMempool_AuthMempool1_Dispatcher<__Handler> {
116 fn prog_vers(&self) -> ::thruput_rpc_api::ProgVers {
117 ::thruput_rpc_api::ProgVers::new(0x8aa87aa7, 1)
118 }
119 async fn dispatch(&self, proc: u32, data: &[u8]) -> Result<Vec<u8>, ::thruput_rpc_api::RpcError> {
120 match proc {
121 2 => {
123 let args: (BlockHeight, SignedTransactionBatch, ) =
124 xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
125 let res = self.inner.authmempool_verify_transactions(args.0, args.1).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
126 xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
127 }
128 3 => {
130 let args: (BlockHeight, SignedTransactionBatch, ) =
131 xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
132 let res = self.inner.authmempool_verify_batch(args.0, args.1).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
133 xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
134 }
135 _ => Err(::thruput_rpc_api::RpcError::InvalidProcedure),
136 }
137 }
138}
139
140#[derive(Clone)]
141pub struct AuthMempool_AuthMempool1_Client {
142 handle: ::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>,
143}
144
145impl AuthMempool_AuthMempool1_Client {
146 pub fn new(handle: ::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>) -> Self {
147 Self { handle }
148 }
149
150 fn prog_vers() -> ::thruput_rpc_api::ProgVers {
151 ::thruput_rpc_api::ProgVers::new(0x8aa87aa7, 1)
152 }
153 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> {
154 let mut call = self.handle.call_buf();
155 call.append_with(|buf| {
156 let mut w = xdrs::txs::buf_writer::BufWriter::from(::core::mem::take(buf));
157 let r = xdrs::write_xdr(&(arg0, arg1), &mut w);
158 *buf = w.into();
159 r
160 }).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
161 let mut out = ::core::option::Option::None;
162 let mut decode = |reply: &[u8]| -> ::core::result::Result<(), ::thruput_rpc_api::RpcError> {
163 out = ::core::option::Option::Some(xdrs::txs::decode(reply).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?);
164 Ok(())
165 };
166 unsafe { self.handle.send_call_decoded(Self::prog_vers(), 2, call, &mut decode) }.await?;
171 out.ok_or(::thruput_rpc_api::RpcError::SystemError)
172 }
173 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> {
174 let mut call = self.handle.call_buf();
175 call.append_with(|buf| {
176 let mut w = xdrs::txs::buf_writer::BufWriter::from(::core::mem::take(buf));
177 let r = xdrs::write_xdr(&(arg0, arg1), &mut w);
178 *buf = w.into();
179 r
180 }).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
181 let mut out = ::core::option::Option::None;
182 let mut decode = |reply: &[u8]| -> ::core::result::Result<(), ::thruput_rpc_api::RpcError> {
183 out = ::core::option::Option::Some(xdrs::txs::decode(reply).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?);
184 Ok(())
185 };
186 unsafe { self.handle.send_call_decoded(Self::prog_vers(), 3, call, &mut decode) }.await?;
191 out.ok_or(::thruput_rpc_api::RpcError::SystemError)
192 }
193}
194
195impl From<::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>> for AuthMempool_AuthMempool1_Client {
196 fn from(handle: ::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>) -> Self {
197 Self::new(handle)
198 }
199}
200
201
202#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
203#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
204#[derive(schemars::JsonSchema)]
205#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
206#[repr(C)]
207pub struct KeyChange {
208 pub address: ContractAddress,
209 pub auth_data: Option<AddressAuthData>,
210}
211
212pub type KeyChangeBatch = VecM::<KeyChange>;
213
214#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
225#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
226#[derive(schemars::JsonSchema)]
227#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
228#[repr(C)]
229pub struct KeyChangeChunk {
230 pub height: BlockHeight,
232 pub chunk_index: u32,
238 pub chunk_count: u32,
239 pub changes: VecM<KeyChange>,
240}
241
242
243#[allow(non_camel_case_types)]
247pub 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;
258}
259
260
261#[allow(non_camel_case_types)]
262pub struct AuthDB_AuthDB1_Dispatcher<__Handler> {
263 inner: Box<__Handler>,
264}
265
266impl<__Handler: AuthDB_AuthDB1> AuthDB_AuthDB1_Dispatcher<__Handler> {
267 pub fn new(inner: Box<__Handler>) -> Self {
268 Self { inner }
269 }
270}
271
272#[async_trait::async_trait]
273impl<__Handler: AuthDB_AuthDB1> ::thruput_rpc_api::RpcHandler for AuthDB_AuthDB1_Dispatcher<__Handler> {
274 fn prog_vers(&self) -> ::thruput_rpc_api::ProgVers {
275 ::thruput_rpc_api::ProgVers::new(0x8aa87aa8, 1)
276 }
277 async fn dispatch(&self, proc: u32, data: &[u8]) -> Result<Vec<u8>, ::thruput_rpc_api::RpcError> {
278 match proc {
279 2 => {
281 let args: (KeyChangeChunk, ) =
282 xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
283 let res = self.inner.authdb_forward_key_changes_chunk(args.0).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
284 xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
285 }
286 _ => Err(::thruput_rpc_api::RpcError::InvalidProcedure),
287 }
288 }
289}
290
291#[derive(Clone)]
292pub struct AuthDB_AuthDB1_Client {
293 handle: ::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>,
294}
295
296impl AuthDB_AuthDB1_Client {
297 pub fn new(handle: ::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>) -> Self {
298 Self { handle }
299 }
300
301 fn prog_vers() -> ::thruput_rpc_api::ProgVers {
302 ::thruput_rpc_api::ProgVers::new(0x8aa87aa8, 1)
303 }
304 pub async fn authdb_forward_key_changes_chunk(&self, arg0 : &(impl xdrs::EncodesAs<KeyChangeChunk> + ?Sized)) -> Result<(), ::thruput_rpc_api::RpcError> {
305 let mut call = self.handle.call_buf();
306 call.append_with(|buf| {
307 let mut w = xdrs::txs::buf_writer::BufWriter::from(::core::mem::take(buf));
308 let r = xdrs::write_xdr(&(arg0), &mut w);
309 *buf = w.into();
310 r
311 }).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
312 let mut out = ::core::option::Option::None;
313 let mut decode = |reply: &[u8]| -> ::core::result::Result<(), ::thruput_rpc_api::RpcError> {
314 out = ::core::option::Option::Some(xdrs::txs::decode(reply).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?);
315 Ok(())
316 };
317 unsafe { self.handle.send_call_decoded(Self::prog_vers(), 2, call, &mut decode) }.await?;
322 out.ok_or(::thruput_rpc_api::RpcError::SystemError)
323 }
324}
325
326impl From<::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>> for AuthDB_AuthDB1_Client {
327 fn from(handle: ::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>) -> Self {
328 Self::new(handle)
329 }
330}
331
332
333#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
334#[cfg_attr(feature = "serde", serde(transparent))]
335#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
336#[derive(schemars::JsonSchema)]
337#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
338#[derive(Copy)]
339#[repr(transparent)]
340pub struct DBAuthError(pub i32);
341
342impl DBAuthError {
343 pub const kDBAuthSuccess: Self = Self(0);
344 pub const kDBAuthNotFound: Self = Self(1);
345 pub const kDBAuthStaleBlockHeight: Self = Self(2);
346 pub const kDBAuthInternal: Self = Self(3);
347}
348impl From<i32> for DBAuthError {
349 fn from(v: i32) -> Self {
350 Self(v)
351 }
352}
353#[cfg(feature = "std")]
354impl core::fmt::Display for DBAuthError {
355 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
356 match self.0 {
357 x if x == Self::kDBAuthSuccess.0 => {
358 write!(f, "DBAuthError::kDBAuthSuccess")
359 },
360 x if x == Self::kDBAuthNotFound.0 => {
361 write!(f, "DBAuthError::kDBAuthNotFound")
362 },
363 x if x == Self::kDBAuthStaleBlockHeight.0 => {
364 write!(f, "DBAuthError::kDBAuthStaleBlockHeight")
365 },
366 x if x == Self::kDBAuthInternal.0 => {
367 write!(f, "DBAuthError::kDBAuthInternal")
368 },
369 _ => {
370 write!(f, "DBAuthError({})", self.0)
371 }
372 }
373 }
374}
375
376
377#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
378#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
379#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
380#[derive(schemars::JsonSchema)]
381#[repr(i32)]
382#[non_exhaustive]
383pub enum DBAuthResult {
384 kDBAuthSuccess { auth_data: AddressAuthData } = DBAuthError::kDBAuthSuccess.0 as i32,
387 #[xdr(default_variant)] Default { error: i32 },
390}
391
392#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
393#[cfg_attr(feature = "serde", serde(transparent))]
394#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
395#[derive(schemars::JsonSchema)]
396#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
397#[derive(Copy)]
398#[repr(transparent)]
399pub struct DBAuthIntroOutcome(pub i32);
400
401impl DBAuthIntroOutcome {
402 pub const kIntroSuccess: Self = Self(0);
403 pub const kIntroFailure: Self = Self(1);
404}
405impl From<i32> for DBAuthIntroOutcome {
406 fn from(v: i32) -> Self {
407 Self(v)
408 }
409}
410#[cfg(feature = "std")]
411impl core::fmt::Display for DBAuthIntroOutcome {
412 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
413 match self.0 {
414 x if x == Self::kIntroSuccess.0 => {
415 write!(f, "DBAuthIntroOutcome::kIntroSuccess")
416 },
417 x if x == Self::kIntroFailure.0 => {
418 write!(f, "DBAuthIntroOutcome::kIntroFailure")
419 },
420 _ => {
421 write!(f, "DBAuthIntroOutcome({})", self.0)
422 }
423 }
424 }
425}
426
427
428#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
429#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
430#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
431#[derive(schemars::JsonSchema)]
432#[repr(i32)]
433#[non_exhaustive]
434pub enum DBAuthIntroResult {
435 kIntroSuccess { current_height: BlockHeight } = DBAuthIntroOutcome::kIntroSuccess.0 as i32,
438 #[xdr(default_variant)] Default { outcome: i32 },
441}
442
443pub type DBAuthResultBatch = VecM::<DBAuthResult>;
444
445
446#[allow(non_camel_case_types)]
450pub 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;
455 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;
458 fn dbauth_intro(&self, arg0 : AuthCard) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<DBAuthIntroResult>, ::thruput_rpc_api::ProgramError>> + Send;
462}
463
464
465#[allow(non_camel_case_types)]
466pub struct DBAuth_DBAuth1_Dispatcher<__Handler> {
467 inner: Box<__Handler>,
468}
469
470impl<__Handler: DBAuth_DBAuth1> DBAuth_DBAuth1_Dispatcher<__Handler> {
471 pub fn new(inner: Box<__Handler>) -> Self {
472 Self { inner }
473 }
474}
475
476#[async_trait::async_trait]
477impl<__Handler: DBAuth_DBAuth1> ::thruput_rpc_api::RpcHandler for DBAuth_DBAuth1_Dispatcher<__Handler> {
478 fn prog_vers(&self) -> ::thruput_rpc_api::ProgVers {
479 ::thruput_rpc_api::ProgVers::new(0x8aa87aa9, 1)
480 }
481 async fn dispatch(&self, proc: u32, data: &[u8]) -> Result<Vec<u8>, ::thruput_rpc_api::RpcError> {
482 match proc {
483 0 => {
485 let args: (BlockHeight, ContractAddress, ) =
486 xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
487 let res = self.inner.authdb_get_auth_data(args.0, args.1).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
488 xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
489 }
490 1 => {
492 let args: (BlockHeight, ContractAddressBatch, ) =
493 xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
494 let res = self.inner.authdb_get_auth_data_batch(args.0, args.1).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
495 xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
496 }
497 2 => {
499 let args: (AuthCard, ) =
500 xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
501 let res = self.inner.dbauth_intro(args.0).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
502 xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
503 }
504 _ => Err(::thruput_rpc_api::RpcError::InvalidProcedure),
505 }
506 }
507}
508
509#[derive(Clone)]
510pub struct DBAuth_DBAuth1_Client {
511 handle: ::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>,
512}
513
514impl DBAuth_DBAuth1_Client {
515 pub fn new(handle: ::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>) -> Self {
516 Self { handle }
517 }
518
519 fn prog_vers() -> ::thruput_rpc_api::ProgVers {
520 ::thruput_rpc_api::ProgVers::new(0x8aa87aa9, 1)
521 }
522 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> {
523 let mut call = self.handle.call_buf();
524 call.append_with(|buf| {
525 let mut w = xdrs::txs::buf_writer::BufWriter::from(::core::mem::take(buf));
526 let r = xdrs::write_xdr(&(arg0, arg1), &mut w);
527 *buf = w.into();
528 r
529 }).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
530 let mut out = ::core::option::Option::None;
531 let mut decode = |reply: &[u8]| -> ::core::result::Result<(), ::thruput_rpc_api::RpcError> {
532 out = ::core::option::Option::Some(xdrs::txs::decode(reply).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?);
533 Ok(())
534 };
535 unsafe { self.handle.send_call_decoded(Self::prog_vers(), 0, call, &mut decode) }.await?;
540 out.ok_or(::thruput_rpc_api::RpcError::SystemError)
541 }
542 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> {
543 let mut call = self.handle.call_buf();
544 call.append_with(|buf| {
545 let mut w = xdrs::txs::buf_writer::BufWriter::from(::core::mem::take(buf));
546 let r = xdrs::write_xdr(&(arg0, arg1), &mut w);
547 *buf = w.into();
548 r
549 }).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
550 let mut out = ::core::option::Option::None;
551 let mut decode = |reply: &[u8]| -> ::core::result::Result<(), ::thruput_rpc_api::RpcError> {
552 out = ::core::option::Option::Some(xdrs::txs::decode(reply).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?);
553 Ok(())
554 };
555 unsafe { self.handle.send_call_decoded(Self::prog_vers(), 1, call, &mut decode) }.await?;
560 out.ok_or(::thruput_rpc_api::RpcError::SystemError)
561 }
562 pub async fn dbauth_intro(&self, arg0 : &(impl xdrs::EncodesAs<AuthCard> + ?Sized)) -> Result<DBAuthIntroResult, ::thruput_rpc_api::RpcError> {
563 let mut call = self.handle.call_buf();
564 call.append_with(|buf| {
565 let mut w = xdrs::txs::buf_writer::BufWriter::from(::core::mem::take(buf));
566 let r = xdrs::write_xdr(&(arg0), &mut w);
567 *buf = w.into();
568 r
569 }).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
570 let mut out = ::core::option::Option::None;
571 let mut decode = |reply: &[u8]| -> ::core::result::Result<(), ::thruput_rpc_api::RpcError> {
572 out = ::core::option::Option::Some(xdrs::txs::decode(reply).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?);
573 Ok(())
574 };
575 unsafe { self.handle.send_call_decoded(Self::prog_vers(), 2, call, &mut decode) }.await?;
580 out.ok_or(::thruput_rpc_api::RpcError::SystemError)
581 }
582}
583
584impl From<::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>> for DBAuth_DBAuth1_Client {
585 fn from(handle: ::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>) -> Self {
586 Self::new(handle)
587 }
588}
589
590
591#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
592#[cfg_attr(feature = "serde", serde(transparent))]
593#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
594#[derive(schemars::JsonSchema)]
595#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
596#[derive(Copy)]
597#[repr(transparent)]
598pub struct IntroAuthOutcome(pub i32);
599
600impl IntroAuthOutcome {
601 pub const kSuccess: Self = Self(0);
602 pub const kFailure: Self = Self(1);
603}
604impl From<i32> for IntroAuthOutcome {
605 fn from(v: i32) -> Self {
606 Self(v)
607 }
608}
609#[cfg(feature = "std")]
610impl core::fmt::Display for IntroAuthOutcome {
611 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
612 match self.0 {
613 x if x == Self::kSuccess.0 => {
614 write!(f, "IntroAuthOutcome::kSuccess")
615 },
616 x if x == Self::kFailure.0 => {
617 write!(f, "IntroAuthOutcome::kFailure")
618 },
619 _ => {
620 write!(f, "IntroAuthOutcome({})", self.0)
621 }
622 }
623 }
624}
625
626
627#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
628#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
629#[derive(schemars::JsonSchema)]
630#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
631#[repr(C)]
632pub struct MempoolAuthIntroSuccess {
633 pub shards: VecM<ShardCard>,
634 pub network_hash: NetworkHash,
635}
636
637#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
638#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
639#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
640#[derive(schemars::JsonSchema)]
641#[repr(i32)]
642#[non_exhaustive]
643pub enum IntroAuthResult {
644 kSuccess { success: MempoolAuthIntroSuccess } = IntroAuthOutcome::kSuccess.0 as i32,
647 #[xdr(default_variant)] Default { outcome: i32 },
650}
651
652
653#[allow(non_camel_case_types)]
657pub 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;
666 fn mempoolauth_auth_data_changed_chunk(&self, arg0 : KeyChangeChunk) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<()>, ::thruput_rpc_api::ProgramError>> + Send;
676 fn mempoolauth_get_auth_info(&self, arg0 : ProtocolCommit) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<IntroAuthResult>, ::thruput_rpc_api::ProgramError>> + Send;
681}
682
683
684#[allow(non_camel_case_types)]
685pub struct MempoolAuth_MempoolAuth1_Dispatcher<__Handler> {
686 inner: Box<__Handler>,
687}
688
689impl<__Handler: MempoolAuth_MempoolAuth1> MempoolAuth_MempoolAuth1_Dispatcher<__Handler> {
690 pub fn new(inner: Box<__Handler>) -> Self {
691 Self { inner }
692 }
693}
694
695#[async_trait::async_trait]
696impl<__Handler: MempoolAuth_MempoolAuth1> ::thruput_rpc_api::RpcHandler for MempoolAuth_MempoolAuth1_Dispatcher<__Handler> {
697 fn prog_vers(&self) -> ::thruput_rpc_api::ProgVers {
698 ::thruput_rpc_api::ProgVers::new(0x8aa87aaa, 1)
699 }
700 async fn dispatch(&self, proc: u32, data: &[u8]) -> Result<Vec<u8>, ::thruput_rpc_api::RpcError> {
701 match proc {
702 0 => {
704 let args: (AuthCard, ) =
705 xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
706 let res = self.inner.mempoolauth_intro_auth(args.0).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
707 xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
708 }
709 2 => {
711 let args: (KeyChangeChunk, ) =
712 xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
713 let res = self.inner.mempoolauth_auth_data_changed_chunk(args.0).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
714 xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
715 }
716 3 => {
718 let args: (ProtocolCommit, ) =
719 xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
720 let res = self.inner.mempoolauth_get_auth_info(args.0).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
721 xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
722 }
723 _ => Err(::thruput_rpc_api::RpcError::InvalidProcedure),
724 }
725 }
726}
727
728#[derive(Clone)]
729pub struct MempoolAuth_MempoolAuth1_Client {
730 handle: ::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>,
731}
732
733impl MempoolAuth_MempoolAuth1_Client {
734 pub fn new(handle: ::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>) -> Self {
735 Self { handle }
736 }
737
738 fn prog_vers() -> ::thruput_rpc_api::ProgVers {
739 ::thruput_rpc_api::ProgVers::new(0x8aa87aaa, 1)
740 }
741 pub async fn mempoolauth_intro_auth(&self, arg0 : &(impl xdrs::EncodesAs<AuthCard> + ?Sized)) -> Result<IntroAuthResult, ::thruput_rpc_api::RpcError> {
742 let mut call = self.handle.call_buf();
743 call.append_with(|buf| {
744 let mut w = xdrs::txs::buf_writer::BufWriter::from(::core::mem::take(buf));
745 let r = xdrs::write_xdr(&(arg0), &mut w);
746 *buf = w.into();
747 r
748 }).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
749 let mut out = ::core::option::Option::None;
750 let mut decode = |reply: &[u8]| -> ::core::result::Result<(), ::thruput_rpc_api::RpcError> {
751 out = ::core::option::Option::Some(xdrs::txs::decode(reply).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?);
752 Ok(())
753 };
754 unsafe { self.handle.send_call_decoded(Self::prog_vers(), 0, call, &mut decode) }.await?;
759 out.ok_or(::thruput_rpc_api::RpcError::SystemError)
760 }
761 pub async fn mempoolauth_auth_data_changed_chunk(&self, arg0 : &(impl xdrs::EncodesAs<KeyChangeChunk> + ?Sized)) -> Result<(), ::thruput_rpc_api::RpcError> {
762 let mut call = self.handle.call_buf();
763 call.append_with(|buf| {
764 let mut w = xdrs::txs::buf_writer::BufWriter::from(::core::mem::take(buf));
765 let r = xdrs::write_xdr(&(arg0), &mut w);
766 *buf = w.into();
767 r
768 }).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
769 let mut out = ::core::option::Option::None;
770 let mut decode = |reply: &[u8]| -> ::core::result::Result<(), ::thruput_rpc_api::RpcError> {
771 out = ::core::option::Option::Some(xdrs::txs::decode(reply).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?);
772 Ok(())
773 };
774 unsafe { self.handle.send_call_decoded(Self::prog_vers(), 2, call, &mut decode) }.await?;
779 out.ok_or(::thruput_rpc_api::RpcError::SystemError)
780 }
781 pub async fn mempoolauth_get_auth_info(&self, arg0 : &(impl xdrs::EncodesAs<ProtocolCommit> + ?Sized)) -> Result<IntroAuthResult, ::thruput_rpc_api::RpcError> {
782 let mut call = self.handle.call_buf();
783 call.append_with(|buf| {
784 let mut w = xdrs::txs::buf_writer::BufWriter::from(::core::mem::take(buf));
785 let r = xdrs::write_xdr(&(arg0), &mut w);
786 *buf = w.into();
787 r
788 }).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
789 let mut out = ::core::option::Option::None;
790 let mut decode = |reply: &[u8]| -> ::core::result::Result<(), ::thruput_rpc_api::RpcError> {
791 out = ::core::option::Option::Some(xdrs::txs::decode(reply).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?);
792 Ok(())
793 };
794 unsafe { self.handle.send_call_decoded(Self::prog_vers(), 3, call, &mut decode) }.await?;
799 out.ok_or(::thruput_rpc_api::RpcError::SystemError)
800 }
801}
802
803impl From<::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>> for MempoolAuth_MempoolAuth1_Client {
804 fn from(handle: ::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>) -> Self {
805 Self::new(handle)
806 }
807}
808
809
810
811impl DBAuthResult {
816 #[allow(clippy::match_single_binding)]
817 pub fn error(&self) -> DBAuthError {
818 match self {
819 DBAuthResult::Default{ error } => (*error).into(),
820
821 _ => (unsafe { *(self as *const Self as *const i32) }).into(),
822 }
823 }
824}
825
826impl DBAuthIntroResult {
827 #[allow(clippy::match_single_binding)]
828 pub fn outcome(&self) -> DBAuthIntroOutcome {
829 match self {
830 DBAuthIntroResult::Default{ outcome } => (*outcome).into(),
831
832 _ => (unsafe { *(self as *const Self as *const i32) }).into(),
833 }
834 }
835}
836
837impl IntroAuthResult {
838 #[allow(clippy::match_single_binding)]
839 pub fn outcome(&self) -> IntroAuthOutcome {
840 match self {
841 IntroAuthResult::Default{ outcome } => (*outcome).into(),
842
843 _ => (unsafe { *(self as *const Self as *const i32) }).into(),
844 }
845 }
846}
847
848