Skip to main content

TicketManagementExt

Trait TicketManagementExt 

pub trait TicketManagementExt: TicketManagement {
    // Provided method
    fn redeem_in_channels<'life0, 'async_trait, C>(
        &'life0 self,
        client: C,
        selector: Option<ChannelSelector>,
        min_amount: Option<Balance<WxHOPR>>,
        min_grace_period: Option<Duration>,
    ) -> Pin<Box<dyn Future<Output = Result<impl Stream<Item = Result<RedemptionResult, Self::Error>> + Send, <C as ChainReadChannelOperations>::Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             C: ChainReadChannelOperations + ChainWriteTicketOperations + Clone + Send + Sync + 'static + 'async_trait,
             Self: Sync + 'async_trait { ... }
}
Expand description

Asynchronous extension trait for TicketManagement that adds convenience methods for ticket management.

Automatically implemented for each type that implements TicketManagement.

Provided Methods§

fn redeem_in_channels<'life0, 'async_trait, C>( &'life0 self, client: C, selector: Option<ChannelSelector>, min_amount: Option<Balance<WxHOPR>>, min_grace_period: Option<Duration>, ) -> Pin<Box<dyn Future<Output = Result<impl Stream<Item = Result<RedemptionResult, Self::Error>> + Send, <C as ChainReadChannelOperations>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, C: ChainReadChannelOperations + ChainWriteTicketOperations + Clone + Send + Sync + 'static + 'async_trait, Self: Sync + 'async_trait,

Performs redemptions in multiple channels.

This method queries the chain client for all incoming channels that are open or have a ticket redemption window open (at least min_grace_period in the future) and optionally also matching the given selector. It then creates a redemption stream for each channel that tries to redeem individual winning tickets in the correct order.

Tickets that are not worth at least min_amount are neglected.

Incoming channels for which the redeem stream could not be created are skipped.

The returned stream can be concurrently processed and guarantees that redeemable tickets are processed in the correct order in their respective channels.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

§

impl<T> TicketManagementExt for T
where T: TicketManagement + ?Sized,