pub struct StellarRelayerTransaction<R, T, J, S, P, C>where
R: Repository<RelayerRepoModel, String>,
T: TransactionRepository,
J: JobProducerTrait,
S: Signer,
P: StellarProviderTrait,
C: TransactionCounterTrait,{ /* private fields */ }
Implementations§
Source§impl<R, T, J, S, P, C> StellarRelayerTransaction<R, T, J, S, P, C>where
R: Repository<RelayerRepoModel, String>,
T: TransactionRepository,
J: JobProducerTrait,
S: Signer,
P: StellarProviderTrait,
C: TransactionCounterTrait,
impl<R, T, J, S, P, C> StellarRelayerTransaction<R, T, J, S, P, C>where
R: Repository<RelayerRepoModel, String>,
T: TransactionRepository,
J: JobProducerTrait,
S: Signer,
P: StellarProviderTrait,
C: TransactionCounterTrait,
Sourcepub fn new(
relayer: RelayerRepoModel,
relayer_repository: Arc<R>,
transaction_repository: Arc<T>,
job_producer: Arc<J>,
signer: Arc<S>,
provider: P,
transaction_counter_service: Arc<C>,
) -> Result<Self, TransactionError>
pub fn new( relayer: RelayerRepoModel, relayer_repository: Arc<R>, transaction_repository: Arc<T>, job_producer: Arc<J>, signer: Arc<S>, provider: P, transaction_counter_service: Arc<C>, ) -> Result<Self, TransactionError>
Creates a new StellarRelayerTransaction
.
§Arguments
relayer
- The relayer model.relayer_repository
- Storage for relayer repository.transaction_repository
- Storage for transaction repository.job_producer
- Producer for job queue.signer
- The Stellar signer.provider
- The Stellar provider.transaction_counter_service
- Service for managing transaction counters.
§Returns
A result containing the new StellarRelayerTransaction
or a TransactionError
.
pub fn provider(&self) -> &P
pub fn relayer(&self) -> &RelayerRepoModel
pub fn job_producer(&self) -> &J
pub fn transaction_repository(&self) -> &T
pub fn signer(&self) -> &S
pub fn transaction_counter_service(&self) -> &C
Sourcepub async fn send_transaction_request_job(
&self,
tx: &TransactionRepoModel,
delay_seconds: Option<i64>,
) -> Result<(), TransactionError>
pub async fn send_transaction_request_job( &self, tx: &TransactionRepoModel, delay_seconds: Option<i64>, ) -> Result<(), TransactionError>
Send a transaction-request job for the given transaction.
Sourcepub async fn finalize_transaction_state(
&self,
tx_id: String,
update_req: TransactionUpdateRequest,
) -> Result<TransactionRepoModel, TransactionError>
pub async fn finalize_transaction_state( &self, tx_id: String, update_req: TransactionUpdateRequest, ) -> Result<TransactionRepoModel, TransactionError>
Helper function to update transaction status, save it, and send a notification.
pub async fn enqueue_next_pending_transaction( &self, finished_tx_id: &str, ) -> Result<(), TransactionError>
Sourcepub async fn sync_sequence_from_chain(
&self,
relayer_address: &str,
) -> Result<(), TransactionError>
pub async fn sync_sequence_from_chain( &self, relayer_address: &str, ) -> Result<(), TransactionError>
Syncs the sequence number from the blockchain for the relayer’s address. This fetches the on-chain sequence number and updates the local counter to the next usable value.
Sourcepub async fn reset_transaction_for_retry(
&self,
tx: TransactionRepoModel,
) -> Result<TransactionRepoModel, TransactionError>
pub async fn reset_transaction_for_retry( &self, tx: TransactionRepoModel, ) -> Result<TransactionRepoModel, TransactionError>
Resets a transaction to its pre-prepare state for reprocessing through the pipeline. This is used when a transaction fails with a bad sequence error and needs to be retried.
Source§impl<R, T, J, S, P, C> StellarRelayerTransaction<R, T, J, S, P, C>where
R: Repository<RelayerRepoModel, String> + Send + Sync,
T: TransactionRepository + Send + Sync,
J: JobProducerTrait + Send + Sync,
S: Signer + Send + Sync,
P: StellarProviderTrait + Send + Sync,
C: TransactionCounterTrait + Send + Sync,
impl<R, T, J, S, P, C> StellarRelayerTransaction<R, T, J, S, P, C>where
R: Repository<RelayerRepoModel, String> + Send + Sync,
T: TransactionRepository + Send + Sync,
J: JobProducerTrait + Send + Sync,
S: Signer + Send + Sync,
P: StellarProviderTrait + Send + Sync,
C: TransactionCounterTrait + Send + Sync,
Sourcepub async fn prepare_transaction_impl(
&self,
tx: TransactionRepoModel,
) -> Result<TransactionRepoModel, TransactionError>
pub async fn prepare_transaction_impl( &self, tx: TransactionRepoModel, ) -> Result<TransactionRepoModel, TransactionError>
Main preparation method with robust error handling and guaranteed lane cleanup.
Source§impl<R, T, J, S, P, C> StellarRelayerTransaction<R, T, J, S, P, C>where
R: Repository<RelayerRepoModel, String> + Send + Sync,
T: TransactionRepository + Send + Sync,
J: JobProducerTrait + Send + Sync,
S: Signer + Send + Sync,
P: StellarProviderTrait + Send + Sync,
C: TransactionCounterTrait + Send + Sync,
impl<R, T, J, S, P, C> StellarRelayerTransaction<R, T, J, S, P, C>where
R: Repository<RelayerRepoModel, String> + Send + Sync,
T: TransactionRepository + Send + Sync,
J: JobProducerTrait + Send + Sync,
S: Signer + Send + Sync,
P: StellarProviderTrait + Send + Sync,
C: TransactionCounterTrait + Send + Sync,
Sourcepub async fn submit_transaction_impl(
&self,
tx: TransactionRepoModel,
) -> Result<TransactionRepoModel, TransactionError>
pub async fn submit_transaction_impl( &self, tx: TransactionRepoModel, ) -> Result<TransactionRepoModel, TransactionError>
Main submission method with robust error handling. Unlike prepare, submit doesn’t claim lanes but still needs proper error handling.
Sourcepub async fn resubmit_transaction_impl(
&self,
tx: TransactionRepoModel,
) -> Result<TransactionRepoModel, TransactionError>
pub async fn resubmit_transaction_impl( &self, tx: TransactionRepoModel, ) -> Result<TransactionRepoModel, TransactionError>
Resubmit transaction - delegates to submit_transaction_impl
Source§impl<R, T, J, S, P, C> StellarRelayerTransaction<R, T, J, S, P, C>where
R: Repository<RelayerRepoModel, String> + Send + Sync,
T: TransactionRepository + Send + Sync,
J: JobProducerTrait + Send + Sync,
S: Signer + Send + Sync,
P: StellarProviderTrait + Send + Sync,
C: TransactionCounterTrait + Send + Sync,
impl<R, T, J, S, P, C> StellarRelayerTransaction<R, T, J, S, P, C>where
R: Repository<RelayerRepoModel, String> + Send + Sync,
T: TransactionRepository + Send + Sync,
J: JobProducerTrait + Send + Sync,
S: Signer + Send + Sync,
P: StellarProviderTrait + Send + Sync,
C: TransactionCounterTrait + Send + Sync,
Sourcepub async fn handle_transaction_status_impl(
&self,
tx: TransactionRepoModel,
) -> Result<TransactionRepoModel, TransactionError>
pub async fn handle_transaction_status_impl( &self, tx: TransactionRepoModel, ) -> Result<TransactionRepoModel, TransactionError>
Main status handling method with robust error handling. This method checks transaction status and handles lane cleanup for finalized transactions.
Sourcepub async fn requeue_status_check(
&self,
tx: &TransactionRepoModel,
) -> Result<(), TransactionError>
pub async fn requeue_status_check( &self, tx: &TransactionRepoModel, ) -> Result<(), TransactionError>
Helper function to re-queue a transaction status check job.
Sourcepub fn parse_and_validate_hash(
&self,
tx: &TransactionRepoModel,
) -> Result<Hash, TransactionError>
pub fn parse_and_validate_hash( &self, tx: &TransactionRepoModel, ) -> Result<Hash, TransactionError>
Parses the transaction hash from the network data and validates it.
Returns a TransactionError::ValidationError
if the hash is missing, empty, or invalid.
Sourcepub async fn handle_stellar_success(
&self,
tx: TransactionRepoModel,
provider_response: GetTransactionResponse,
) -> Result<TransactionRepoModel, TransactionError>
pub async fn handle_stellar_success( &self, tx: TransactionRepoModel, provider_response: GetTransactionResponse, ) -> Result<TransactionRepoModel, TransactionError>
Handles the logic when a Stellar transaction is confirmed successfully.
Sourcepub async fn handle_stellar_failed(
&self,
tx: TransactionRepoModel,
provider_response: GetTransactionResponse,
) -> Result<TransactionRepoModel, TransactionError>
pub async fn handle_stellar_failed( &self, tx: TransactionRepoModel, provider_response: GetTransactionResponse, ) -> Result<TransactionRepoModel, TransactionError>
Handles the logic when a Stellar transaction has failed.
Sourcepub async fn handle_stellar_pending(
&self,
tx: TransactionRepoModel,
original_status_str: String,
) -> Result<TransactionRepoModel, TransactionError>
pub async fn handle_stellar_pending( &self, tx: TransactionRepoModel, original_status_str: String, ) -> Result<TransactionRepoModel, TransactionError>
Handles the logic when a Stellar transaction is still pending or in an unknown state.
Trait Implementations§
Source§impl<R, T, J, S, P, C> Transaction for StellarRelayerTransaction<R, T, J, S, P, C>where
R: Repository<RelayerRepoModel, String> + Send + Sync,
T: TransactionRepository + Send + Sync,
J: JobProducerTrait + Send + Sync,
S: Signer + Send + Sync,
P: StellarProviderTrait + Send + Sync,
C: TransactionCounterTrait + Send + Sync,
impl<R, T, J, S, P, C> Transaction for StellarRelayerTransaction<R, T, J, S, P, C>where
R: Repository<RelayerRepoModel, String> + Send + Sync,
T: TransactionRepository + Send + Sync,
J: JobProducerTrait + Send + Sync,
S: Signer + Send + Sync,
P: StellarProviderTrait + Send + Sync,
C: TransactionCounterTrait + Send + Sync,
Source§fn prepare_transaction<'life0, 'async_trait>(
&'life0 self,
tx: TransactionRepoModel,
) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, TransactionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn prepare_transaction<'life0, 'async_trait>(
&'life0 self,
tx: TransactionRepoModel,
) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, TransactionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn submit_transaction<'life0, 'async_trait>(
&'life0 self,
tx: TransactionRepoModel,
) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, TransactionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn submit_transaction<'life0, 'async_trait>(
&'life0 self,
tx: TransactionRepoModel,
) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, TransactionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn resubmit_transaction<'life0, 'async_trait>(
&'life0 self,
tx: TransactionRepoModel,
) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, TransactionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn resubmit_transaction<'life0, 'async_trait>(
&'life0 self,
tx: TransactionRepoModel,
) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, TransactionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn handle_transaction_status<'life0, 'async_trait>(
&'life0 self,
tx: TransactionRepoModel,
) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, TransactionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_transaction_status<'life0, 'async_trait>(
&'life0 self,
tx: TransactionRepoModel,
) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, TransactionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn cancel_transaction<'life0, 'async_trait>(
&'life0 self,
tx: TransactionRepoModel,
) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, TransactionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn cancel_transaction<'life0, 'async_trait>(
&'life0 self,
tx: TransactionRepoModel,
) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, TransactionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn replace_transaction<'life0, 'async_trait>(
&'life0 self,
_old_tx: TransactionRepoModel,
_new_tx_request: NetworkTransactionRequest,
) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, TransactionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn replace_transaction<'life0, 'async_trait>(
&'life0 self,
_old_tx: TransactionRepoModel,
_new_tx_request: NetworkTransactionRequest,
) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, TransactionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn sign_transaction<'life0, 'async_trait>(
&'life0 self,
tx: TransactionRepoModel,
) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, TransactionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn sign_transaction<'life0, 'async_trait>(
&'life0 self,
tx: TransactionRepoModel,
) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, TransactionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn validate_transaction<'life0, 'async_trait>(
&'life0 self,
_tx: TransactionRepoModel,
) -> Pin<Box<dyn Future<Output = Result<bool, TransactionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn validate_transaction<'life0, 'async_trait>(
&'life0 self,
_tx: TransactionRepoModel,
) -> Pin<Box<dyn Future<Output = Result<bool, TransactionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl<R, T, J, S, P, C> Freeze for StellarRelayerTransaction<R, T, J, S, P, C>where
P: Freeze,
impl<R, T, J, S, P, C> RefUnwindSafe for StellarRelayerTransaction<R, T, J, S, P, C>where
P: RefUnwindSafe,
R: RefUnwindSafe,
T: RefUnwindSafe,
J: RefUnwindSafe,
S: RefUnwindSafe,
C: RefUnwindSafe,
impl<R, T, J, S, P, C> Send for StellarRelayerTransaction<R, T, J, S, P, C>
impl<R, T, J, S, P, C> Sync for StellarRelayerTransaction<R, T, J, S, P, C>
impl<R, T, J, S, P, C> Unpin for StellarRelayerTransaction<R, T, J, S, P, C>where
P: Unpin,
impl<R, T, J, S, P, C> UnwindSafe for StellarRelayerTransaction<R, T, J, S, P, C>where
P: UnwindSafe,
R: RefUnwindSafe,
T: RefUnwindSafe,
J: RefUnwindSafe,
S: RefUnwindSafe,
C: RefUnwindSafe,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg
] or
a color-specific method, such as [OwoColorize::green
], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg
] or
a color-specific method, such as [OwoColorize::on_yellow
], Read more