pub struct ChannelEndState {Show 14 fields
pub address: Address,
pub contract_balance: TokenAmount,
pub onchain_total_withdraw: TokenAmount,
pub withdraws_pending: HashMap<U256, PendingWithdrawState>,
pub withdraws_expired: Vec<ExpiredWithdrawState>,
pub initiated_coop_settle: Option<CoopSettleState>,
pub expired_coop_settles: Vec<CoopSettleState>,
pub secrethashes_to_lockedlocks: HashMap<SecretHash, HashTimeLockState>,
pub secrethashes_to_unlockedlocks: HashMap<SecretHash, UnlockPartialProofState>,
pub secrethashes_to_onchain_unlockedlocks: HashMap<SecretHash, UnlockPartialProofState>,
pub balance_proof: Option<BalanceProofState>,
pub pending_locks: PendingLocksState,
pub onchain_locksroot: Locksroot,
pub nonce: Nonce,
}Expand description
The state of one of the nodes in a two party channel.
Fields§
§address: Address§contract_balance: TokenAmount§onchain_total_withdraw: TokenAmount§withdraws_pending: HashMap<U256, PendingWithdrawState>§withdraws_expired: Vec<ExpiredWithdrawState>§initiated_coop_settle: Option<CoopSettleState>§expired_coop_settles: Vec<CoopSettleState>§secrethashes_to_lockedlocks: HashMap<SecretHash, HashTimeLockState>§secrethashes_to_unlockedlocks: HashMap<SecretHash, UnlockPartialProofState>§secrethashes_to_onchain_unlockedlocks: HashMap<SecretHash, UnlockPartialProofState>§balance_proof: Option<BalanceProofState>§pending_locks: PendingLocksState§onchain_locksroot: Locksroot§nonce: NonceImplementations§
Source§impl ChannelEndState
impl ChannelEndState
Sourcepub fn offchain_total_withdraw(&self) -> TokenAmount
pub fn offchain_total_withdraw(&self) -> TokenAmount
returns the off-chain total withdraw amount.
Sourcepub fn total_withdraw(&self) -> TokenAmount
pub fn total_withdraw(&self) -> TokenAmount
Returns the total of off-chain and on-chain withdraw amounts.
Sourcepub fn next_nonce(&self) -> Nonce
pub fn next_nonce(&self) -> Nonce
Returns the next usable nonce.
Sourcepub fn count_pending_transfers(&self) -> usize
pub fn count_pending_transfers(&self) -> usize
Returns the number of pending transfers.
Sourcepub fn locked_amount(&self) -> TokenAmount
pub fn locked_amount(&self) -> TokenAmount
Returns the total amount locked.
Sourcepub fn get_current_balanceproof(&self) -> BalanceProofData
pub fn get_current_balanceproof(&self) -> BalanceProofData
Returns the latest balance proof.
Sourcepub fn is_valid_amount(&self, amount: TokenAmount) -> bool
pub fn is_valid_amount(&self, amount: TokenAmount) -> bool
Returns true if the amount after unlock is valid
Sourcepub fn is_secret_known(&self, secrethash: SecretHash) -> bool
pub fn is_secret_known(&self, secrethash: SecretHash) -> bool
Returns true if secret is known either off-chain or on-chain.
Sourcepub fn secret_known_onchain(&self, secrethash: SecretHash) -> bool
pub fn secret_known_onchain(&self, secrethash: SecretHash) -> bool
Returns true if secret is known on-chain.
Sourcepub fn is_secret_known_offchain(&self, secrethash: SecretHash) -> bool
pub fn is_secret_known_offchain(&self, secrethash: SecretHash) -> bool
Returns true if secret is known off-chain.
Sourcepub fn get_secret(&self, secrethash: SecretHash) -> Option<Secret>
pub fn get_secret(&self, secrethash: SecretHash) -> Option<Secret>
Returns the secret of a lock if known.
Trait Implementations§
Source§impl Clone for ChannelEndState
impl Clone for ChannelEndState
Source§fn clone(&self) -> ChannelEndState
fn clone(&self) -> ChannelEndState
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 ChannelEndState
impl Debug for ChannelEndState
Source§impl Default for ChannelEndState
impl Default for ChannelEndState
Source§fn default() -> ChannelEndState
fn default() -> ChannelEndState
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ChannelEndState
impl<'de> Deserialize<'de> for ChannelEndState
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 ChannelEndState
impl PartialEq for ChannelEndState
Source§impl Serialize for ChannelEndState
impl Serialize for ChannelEndState
impl Eq for ChannelEndState
impl StructuralPartialEq for ChannelEndState
Auto Trait Implementations§
impl Freeze for ChannelEndState
impl RefUnwindSafe for ChannelEndState
impl Send for ChannelEndState
impl Sync for ChannelEndState
impl Unpin for ChannelEndState
impl UnwindSafe for ChannelEndState
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.