Struct ChannelEntry
pub struct ChannelEntry {
pub source: Address,
pub destination: Address,
pub balance: Balance<WxHOPR>,
pub ticket_index: u64,
pub status: ChannelStatus,
pub channel_epoch: u32,
id: HashBase<CoreWrapper<Keccak256Core>>,
}Expand description
Overall description of a channel
Fields§
§source: AddressSource address of the channel.
destination: AddressDestination address of the channel.
balance: Balance<WxHOPR>Stake amount on the channel in wxHOPR tokens.
ticket_index: u64Next ticket index of the channel.
status: ChannelStatusCurrent status of the channel.
channel_epoch: u32Epoch of the channel.
id: HashBase<CoreWrapper<Keccak256Core>>Implementations§
§impl ChannelEntry
impl ChannelEntry
pub fn builder() -> ChannelBuilder
pub fn builder() -> ChannelBuilder
Creates a new [ChannelBuilder].
pub fn new(
source: Address,
destination: Address,
balance: Balance<WxHOPR>,
ticket_index: u64,
status: ChannelStatus,
channel_epoch: u32,
) -> ChannelEntry
👎Deprecated since 1.3.0: use ChannelBuilder instead
pub fn new( source: Address, destination: Address, balance: Balance<WxHOPR>, ticket_index: u64, status: ChannelStatus, channel_epoch: u32, ) -> ChannelEntry
DEPRECATED Construct a new channel entry.
pub fn get_id(&self) -> &HashBase<CoreWrapper<Keccak256Core>>
pub fn get_id(&self) -> &HashBase<CoreWrapper<Keccak256Core>>
Generates the channel ID using the source and destination address
pub fn closure_time_passed(&self, current_time: SystemTime) -> bool
pub fn closure_time_passed(&self, current_time: SystemTime) -> bool
Checks if the closure time of this channel has passed.
Also returns false if the channel closure has not been initiated (it is in Open state).
Returns also true if the channel is in Closed state.
pub fn remaining_closure_time(
&self,
current_time: SystemTime,
) -> Option<Duration>
pub fn remaining_closure_time( &self, current_time: SystemTime, ) -> Option<Duration>
Calculates the remaining channel closure grace period.
Returns None if the channel closure has not been initiated yet (channel is in Open state).
pub fn closure_time_at(&self) -> Option<SystemTime>
pub fn closure_time_at(&self) -> Option<SystemTime>
Returns the earliest time the channel can transition from PendingToClose into Closed.
If the channel is not in the PendingToClose state, it returns None.
pub fn direction(&self, me: &Address) -> Option<ChannelDirection>
pub fn direction(&self, me: &Address) -> Option<ChannelDirection>
Determines the channel direction given the self-address.
Returns None if neither source nor destination are equal to me.
pub fn orientation(&self, me: &Address) -> Option<(ChannelDirection, Address)>
pub fn orientation(&self, me: &Address) -> Option<(ChannelDirection, Address)>
Determines the channel’s direction and counterparty relative to me.
Returns None if neither source nor destination are equal to me.
pub fn diff(&self, other: &ChannelEntry) -> Vec<ChannelChange>
pub fn diff(&self, other: &ChannelEntry) -> Vec<ChannelChange>
Makes a diff of this channel (left) and the other channel (right).
The channels must have the same ID.
See [ChannelChange]
Trait Implementations§
§impl Clone for ChannelEntry
impl Clone for ChannelEntry
§fn clone(&self) -> ChannelEntry
fn clone(&self) -> ChannelEntry
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for ChannelEntry
impl Debug for ChannelEntry
§impl<'de> Deserialize<'de> for ChannelEntry
impl<'de> Deserialize<'de> for ChannelEntry
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ChannelEntry, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ChannelEntry, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl Display for ChannelEntry
impl Display for ChannelEntry
§impl Hash for ChannelEntry
impl Hash for ChannelEntry
§impl PartialEq for ChannelEntry
impl PartialEq for ChannelEntry
§impl Serialize for ChannelEntry
impl Serialize for ChannelEntry
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Copy for ChannelEntry
impl Eq for ChannelEntry
impl StructuralPartialEq for ChannelEntry
Auto Trait Implementations§
impl Freeze for ChannelEntry
impl RefUnwindSafe for ChannelEntry
impl Send for ChannelEntry
impl Sync for ChannelEntry
impl Unpin for ChannelEntry
impl UnwindSafe for ChannelEntry
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§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<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.