pub enum Parity {
Eip155(u64),
NonEip155(bool),
Parity(bool),
}
Expand description
The parity of the signature, stored as either a V value (which may include a chain id), or the y-parity.
Variantsยง
Eip155(u64)
Explicit V value. May be EIP-155 modified.
NonEip155(bool)
Non-EIP155. 27 or 28.
Parity(bool)
Parity flag. True for odd.
Implementationsยง
Sourceยงimpl Parity
impl Parity
Sourcepub const fn chain_id(&self) -> Option<ChainId>
pub const fn chain_id(&self) -> Option<ChainId>
Returns the chain ID associated with the V value, if this signature is replay-protected by EIP-155.
Sourcepub const fn has_eip155_value(&self) -> bool
pub const fn has_eip155_value(&self) -> bool
Returns true if the signature is replay-protected by EIP-155.
This is true if the V value is 35 or greater. Values less than 35 are either not replay protected (27/28), or are invalid.
Sourcepub const fn y_parity_byte(&self) -> u8
pub const fn y_parity_byte(&self) -> u8
Return the y-parity as 0 or 1
Sourcepub const fn y_parity_byte_non_eip155(&self) -> Option<u8>
pub const fn y_parity_byte_non_eip155(&self) -> Option<u8>
Return the y-parity byte as 27 or 28, in the case of a non-EIP155 signature.
Sourcepub const fn strip_chain_id(&self) -> Self
pub const fn strip_chain_id(&self) -> Self
Converts an EIP-155 V value to a non-EIP-155 V value.
This is a nop for non-EIP-155 values.
Sourcepub const fn with_chain_id(self, chain_id: ChainId) -> Self
pub const fn with_chain_id(self, chain_id: ChainId) -> Self
Applies EIP-155 with the given chain ID.
Sourcepub const fn recid(&self) -> RecoveryId
pub const fn recid(&self) -> RecoveryId
Determines the recovery ID.
Sourcepub const fn to_parity_bool(self) -> Self
pub const fn to_parity_bool(self) -> Self
Convert to a parity bool, dropping any V information.
Trait Implementationsยง
Sourceยงimpl From<RecoveryId> for Parity
impl From<RecoveryId> for Parity
Sourceยงfn from(value: RecoveryId) -> Self
fn from(value: RecoveryId) -> Self
impl Copy for Parity
impl Eq for Parity
impl StructuralPartialEq for Parity
Auto Trait Implementationsยง
impl Freeze for Parity
impl RefUnwindSafe for Parity
impl Send for Parity
impl Sync for Parity
impl Unpin for Parity
impl UnwindSafe for Parity
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,
Sourceยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Sourceยงfn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.