Trait IncentiveChannelOperations
pub trait IncentiveChannelOperations: HasChainApi {
const CHAIN_OPERATION_TIMEOUT_MULTIPLIER: u32 = 2;
Show 16 methods
// Provided methods
fn open_channel<'life0, 'async_trait, A>(
&'life0 self,
destination: A,
amount: Balance<WxHOPR>,
) -> Pin<Box<dyn Future<Output = Result<ChainOutput<HashBase<CoreWrapper<Keccak256Core>>>, EitherErr<<Self::ChainApi as HoprChainApi>::ChainError, Self::ChainError>>> + Send + 'async_trait>>
where 'life0: 'async_trait,
A: 'async_trait + Into<Address> + Send,
Self: Sync + 'async_trait { ... }
fn fund_channel<'life0, 'life1, 'async_trait>(
&'life0 self,
channel_id: &'life1 HashBase<CoreWrapper<Keccak256Core>>,
amount: Balance<WxHOPR>,
) -> Pin<Box<dyn Future<Output = Result<ChainOutput<()>, EitherErr<<Self::ChainApi as HoprChainApi>::ChainError, Self::ChainError>>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait { ... }
fn close_channel_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
channel_id: &'life1 HashBase<CoreWrapper<Keccak256Core>>,
) -> Pin<Box<dyn Future<Output = Result<ChainOutput<ChannelStatus>, EitherErr<<Self::ChainApi as HoprChainApi>::ChainError, Self::ChainError>>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait { ... }
fn channel_by_id(
&self,
channel_id: &HashBase<CoreWrapper<Keccak256Core>>,
) -> Result<Option<ChannelEntry>, <Self::ChainApi as HoprChainApi>::ChainError> { ... }
fn channel<A, B>(
&self,
source: A,
destination: B,
) -> Result<Option<ChannelEntry>, <Self::ChainApi as HoprChainApi>::ChainError>
where A: Into<Address> + Send,
B: Into<Address> + Send { ... }
fn channels_to<'life0, 'async_trait, A>(
&'life0 self,
destination: A,
) -> Pin<Box<dyn Future<Output = Result<Vec<ChannelEntry>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
A: 'async_trait + Into<Address> + Send,
Self: Sync + 'async_trait { ... }
fn channels_from<'life0, 'async_trait, A>(
&'life0 self,
source: A,
) -> Pin<Box<dyn Future<Output = Result<Vec<ChannelEntry>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
A: 'async_trait + Into<Address> + Send,
Self: Sync + 'async_trait { ... }
fn get_balance<'life0, 'async_trait, C>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Balance<C>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
C: 'async_trait + Currency + Send,
Self: Sync + 'async_trait { ... }
fn get_safe_balance<'life0, 'async_trait, C>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Balance<C>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
C: 'async_trait + Currency + Send,
Self: Sync + 'async_trait { ... }
fn safe_allowance<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Balance<WxHOPR>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: Sync + 'async_trait { ... }
fn withdraw<'life0, 'life1, 'async_trait, C>(
&'life0 self,
recipient: &'life1 Address,
amount: Balance<C>,
) -> Pin<Box<dyn Future<Output = Result<ChainOutput<()>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
C: 'async_trait + Currency + Send,
Self: Sync + 'async_trait { ... }
fn chain_info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ChainInfo, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: Sync + 'async_trait { ... }
fn get_ticket_price<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Balance<WxHOPR>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: Sync + 'async_trait { ... }
fn get_minimum_incoming_ticket_win_probability<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<WinningProbability, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: Sync + 'async_trait { ... }
fn get_channel_closure_notice_period<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Duration, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: Sync + 'async_trait { ... }
fn announced_peers<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<AccountEntry>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: Sync + 'async_trait { ... }
}Expand description
Channel management, balance queries, withdrawals, and chain info.
Available on all node types — requires only HasChainApi.
Automatically implemented for any type providing chain access.
Provided Associated Constants§
const CHAIN_OPERATION_TIMEOUT_MULTIPLIER: u32 = 2
const CHAIN_OPERATION_TIMEOUT_MULTIPLIER: u32 = 2
Timeout multiplier applied to ChainValues::typical_resolution_time
when waiting for on-chain operations to be confirmed via the event bus.
Provided Methods§
fn open_channel<'life0, 'async_trait, A>(
&'life0 self,
destination: A,
amount: Balance<WxHOPR>,
) -> Pin<Box<dyn Future<Output = Result<ChainOutput<HashBase<CoreWrapper<Keccak256Core>>>, EitherErr<<Self::ChainApi as HoprChainApi>::ChainError, Self::ChainError>>> + Send + 'async_trait>>
fn open_channel<'life0, 'async_trait, A>( &'life0 self, destination: A, amount: Balance<WxHOPR>, ) -> Pin<Box<dyn Future<Output = Result<ChainOutput<HashBase<CoreWrapper<Keccak256Core>>>, EitherErr<<Self::ChainApi as HoprChainApi>::ChainError, Self::ChainError>>> + Send + 'async_trait>>
Opens a channel from the node to the given destination with the given amount as the initial stake.
fn fund_channel<'life0, 'life1, 'async_trait>(
&'life0 self,
channel_id: &'life1 HashBase<CoreWrapper<Keccak256Core>>,
amount: Balance<WxHOPR>,
) -> Pin<Box<dyn Future<Output = Result<ChainOutput<()>, EitherErr<<Self::ChainApi as HoprChainApi>::ChainError, Self::ChainError>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
fn fund_channel<'life0, 'life1, 'async_trait>(
&'life0 self,
channel_id: &'life1 HashBase<CoreWrapper<Keccak256Core>>,
amount: Balance<WxHOPR>,
) -> Pin<Box<dyn Future<Output = Result<ChainOutput<()>, EitherErr<<Self::ChainApi as HoprChainApi>::ChainError, Self::ChainError>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
Funds an existing channel with the given amount.
fn close_channel_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
channel_id: &'life1 HashBase<CoreWrapper<Keccak256Core>>,
) -> Pin<Box<dyn Future<Output = Result<ChainOutput<ChannelStatus>, EitherErr<<Self::ChainApi as HoprChainApi>::ChainError, Self::ChainError>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
fn close_channel_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
channel_id: &'life1 HashBase<CoreWrapper<Keccak256Core>>,
) -> Pin<Box<dyn Future<Output = Result<ChainOutput<ChannelStatus>, EitherErr<<Self::ChainApi as HoprChainApi>::ChainError, Self::ChainError>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
Initiates or finalizes the closure of a channel.
fn channel_by_id(
&self,
channel_id: &HashBase<CoreWrapper<Keccak256Core>>,
) -> Result<Option<ChannelEntry>, <Self::ChainApi as HoprChainApi>::ChainError>
fn channel_by_id( &self, channel_id: &HashBase<CoreWrapper<Keccak256Core>>, ) -> Result<Option<ChannelEntry>, <Self::ChainApi as HoprChainApi>::ChainError>
Returns a channel with the given channel_id.
fn channel<A, B>(
&self,
source: A,
destination: B,
) -> Result<Option<ChannelEntry>, <Self::ChainApi as HoprChainApi>::ChainError>
fn channel<A, B>( &self, source: A, destination: B, ) -> Result<Option<ChannelEntry>, <Self::ChainApi as HoprChainApi>::ChainError>
Returns a channel between source and destination.
fn channels_to<'life0, 'async_trait, A>(
&'life0 self,
destination: A,
) -> Pin<Box<dyn Future<Output = Result<Vec<ChannelEntry>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
fn channels_to<'life0, 'async_trait, A>( &'life0 self, destination: A, ) -> Pin<Box<dyn Future<Output = Result<Vec<ChannelEntry>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
Returns all channels to the given destination.
fn channels_from<'life0, 'async_trait, A>(
&'life0 self,
source: A,
) -> Pin<Box<dyn Future<Output = Result<Vec<ChannelEntry>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
fn channels_from<'life0, 'async_trait, A>( &'life0 self, source: A, ) -> Pin<Box<dyn Future<Output = Result<Vec<ChannelEntry>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
Returns all channels from the given source.
fn get_balance<'life0, 'async_trait, C>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Balance<C>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
fn get_balance<'life0, 'async_trait, C>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Balance<C>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
Returns the balance of Currency in the node’s account.
fn get_safe_balance<'life0, 'async_trait, C>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Balance<C>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
fn get_safe_balance<'life0, 'async_trait, C>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Balance<C>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
Returns the balance of Currency in the node’s Safe.
fn safe_allowance<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Balance<WxHOPR>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
fn safe_allowance<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Balance<WxHOPR>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
Returns the allowance of the node’s Safe to spend funds in channels.
fn withdraw<'life0, 'life1, 'async_trait, C>(
&'life0 self,
recipient: &'life1 Address,
amount: Balance<C>,
) -> Pin<Box<dyn Future<Output = Result<ChainOutput<()>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
fn withdraw<'life0, 'life1, 'async_trait, C>( &'life0 self, recipient: &'life1 Address, amount: Balance<C>, ) -> Pin<Box<dyn Future<Output = Result<ChainOutput<()>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
Withdraws the given amount of Currency from the node to the recipient.
fn chain_info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ChainInfo, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
fn chain_info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ChainInfo, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
Returns information about the connected blockchain.
fn get_ticket_price<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Balance<WxHOPR>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
fn get_ticket_price<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Balance<WxHOPR>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
Returns the minimum ticket price from the blockchain.
fn get_minimum_incoming_ticket_win_probability<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<WinningProbability, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
fn get_minimum_incoming_ticket_win_probability<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<WinningProbability, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
Returns the minimum win probability of an incoming ticket.
fn get_channel_closure_notice_period<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Duration, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
fn get_channel_closure_notice_period<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Duration, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
Returns the channel closure grace period.
fn announced_peers<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<AccountEntry>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
fn announced_peers<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<AccountEntry>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
Returns all peers that have been publicly announced on-chain.
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> IncentiveChannelOperations for T
Blanket: any type with chain access gets channel operations.