Enum Parity
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§
§impl Parity
impl Parity
pub const fn chain_id(&self) -> Option<u64>
pub const fn chain_id(&self) -> Option<u64>
Returns the chain ID associated with the V value, if this signature is replay-protected by EIP-155.
pub 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.
pub const fn y_parity_byte(&self) -> u8
pub const fn y_parity_byte(&self) -> u8
Return the y-parity as 0 or 1
pub 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.
pub const fn strip_chain_id(&self) -> Parity
pub const fn strip_chain_id(&self) -> Parity
Converts an EIP-155 V value to a non-EIP-155 V value.
This is a nop for non-EIP-155 values.
pub const fn with_chain_id(self, chain_id: u64) -> Parity
pub const fn with_chain_id(self, chain_id: u64) -> Parity
Applies EIP-155 with the given chain ID.
pub const fn recid(&self) -> RecoveryId
pub const fn recid(&self) -> RecoveryId
Determines the recovery ID.
pub const fn to_parity_bool(self) -> Parity
pub const fn to_parity_bool(self) -> Parity
Convert to a parity bool, dropping any V information.