pub struct ChannelState {
pub canonical_identifier: CanonicalIdentifier,
pub token_address: TokenAddress,
pub token_network_registry_address: TokenNetworkRegistryAddress,
pub reveal_timeout: RevealTimeout,
pub settle_timeout: SettleTimeout,
pub fee_schedule: FeeScheduleState,
pub our_state: ChannelEndState,
pub partner_state: ChannelEndState,
pub open_transaction: TransactionExecutionStatus,
pub close_transaction: Option<TransactionExecutionStatus>,
pub settle_transaction: Option<TransactionExecutionStatus>,
pub update_transaction: Option<TransactionExecutionStatus>,
}Expand description
The state of a channel.“”“
Fields§
§canonical_identifier: CanonicalIdentifier§token_address: TokenAddress§token_network_registry_address: TokenNetworkRegistryAddress§reveal_timeout: RevealTimeout§settle_timeout: SettleTimeout§fee_schedule: FeeScheduleState§our_state: ChannelEndState§partner_state: ChannelEndState§open_transaction: TransactionExecutionStatus§close_transaction: Option<TransactionExecutionStatus>§settle_transaction: Option<TransactionExecutionStatus>§update_transaction: Option<TransactionExecutionStatus>Implementations§
Source§impl ChannelState
impl ChannelState
Sourcepub fn new(
canonical_identifier: CanonicalIdentifier,
token_address: TokenAddress,
token_network_registry_address: TokenNetworkRegistryAddress,
our_address: Address,
partner_address: Address,
reveal_timeout: RevealTimeout,
settle_timeout: SettleTimeout,
open_transaction: TransactionExecutionStatus,
fee_config: MediationFeeConfig,
) -> Result<ChannelState, StateTransitionError>
pub fn new( canonical_identifier: CanonicalIdentifier, token_address: TokenAddress, token_network_registry_address: TokenNetworkRegistryAddress, our_address: Address, partner_address: Address, reveal_timeout: RevealTimeout, settle_timeout: SettleTimeout, open_transaction: TransactionExecutionStatus, fee_config: MediationFeeConfig, ) -> Result<ChannelState, StateTransitionError>
Create an instance of ChannelState'.
Sourcepub fn status(&self) -> ChannelStatus
pub fn status(&self) -> ChannelStatus
Returns the status of the channel state.
Sourcepub fn our_total_deposit(&self) -> TokenAmount
pub fn our_total_deposit(&self) -> TokenAmount
Returns total deposit amount for our side.
Sourcepub fn partner_total_deposit(&self) -> TokenAmount
pub fn partner_total_deposit(&self) -> TokenAmount
Returns total deposit amount for partner’s side.
Sourcepub fn our_total_withdraw(&self) -> TokenAmount
pub fn our_total_withdraw(&self) -> TokenAmount
Returns the total withdraw amount for our side.
Sourcepub fn partner_total_withdraw(&self) -> TokenAmount
pub fn partner_total_withdraw(&self) -> TokenAmount
Returns the total withdraw amount for partner’s side.
Sourcepub fn capacity(&self) -> TokenAmount
pub fn capacity(&self) -> TokenAmount
Returns the total capacity amount for the channel.
Sourcepub fn is_usable_for_new_transfer(
&self,
amount: TokenAmount,
lock_timeout: Option<LockTimeout>,
) -> bool
pub fn is_usable_for_new_transfer( &self, amount: TokenAmount, lock_timeout: Option<LockTimeout>, ) -> bool
Returns true if a channel is usable for a new transfer.
Sourcepub fn is_usable_for_mediation(
&self,
transfer_amount: TokenAmount,
lock_timeout: BlockTimeout,
) -> bool
pub fn is_usable_for_mediation( &self, transfer_amount: TokenAmount, lock_timeout: BlockTimeout, ) -> bool
Returns true of channel is usable to mediate a transfer.
Trait Implementations§
Source§impl Clone for ChannelState
impl Clone for ChannelState
Source§fn clone(&self) -> ChannelState
fn clone(&self) -> ChannelState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ChannelState
impl Debug for ChannelState
Source§impl<'de> Deserialize<'de> for ChannelState
impl<'de> Deserialize<'de> for ChannelState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ChannelState
impl PartialEq for ChannelState
Source§impl Serialize for ChannelState
impl Serialize for ChannelState
impl Eq for ChannelState
impl StructuralPartialEq for ChannelState
Auto Trait Implementations§
impl Freeze for ChannelState
impl RefUnwindSafe for ChannelState
impl Send for ChannelState
impl Sync for ChannelState
impl Unpin for ChannelState
impl UnwindSafe for ChannelState
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
Mutably borrows from an owned value. Read more
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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 moreSource§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.