alloy_consensus

Trait EncodableSignature

source
pub trait EncodableSignature: Sized {
Show 13 methods // Required methods fn from_rs_and_parity<P: TryInto<Parity, Error = E>, E: Into<SignatureError>>( r: U256, s: U256, parity: P, ) -> Result<Self, SignatureError>; fn r(&self) -> U256; fn s(&self) -> U256; fn v(&self) -> Parity; fn with_parity<T: Into<Parity>>(self, parity: T) -> Self; // Provided methods fn with_chain_id(self, chain_id: u64) -> Self where Self: Copy { ... } fn with_parity_bool(self) -> Self where Self: Copy { ... } fn decode_rlp_vrs(buf: &mut &[u8]) -> Result<Self, Error> { ... } fn rlp_rs_len(&self) -> usize { ... } fn rlp_vrs_len(&self) -> usize { ... } fn write_rlp_rs(&self, out: &mut dyn BufMut) { ... } fn write_rlp_v(&self, out: &mut dyn BufMut) { ... } fn write_rlp_vrs(&self, out: &mut dyn BufMut) { ... }
}
Expand description

Helper trait used to streamline signatures encoding.

Required Methods§

source

fn from_rs_and_parity<P: TryInto<Parity, Error = E>, E: Into<SignatureError>>( r: U256, s: U256, parity: P, ) -> Result<Self, SignatureError>

Instantiate from v, r, s.

source

fn r(&self) -> U256

Returns the r component of this signature.

source

fn s(&self) -> U256

Returns the s component of this signature.

source

fn v(&self) -> Parity

Returns the recovery ID as a u8.

source

fn with_parity<T: Into<Parity>>(self, parity: T) -> Self

Sets the recovery ID by normalizing a v value.

Provided Methods§

source

fn with_chain_id(self, chain_id: u64) -> Self
where Self: Copy,

Modifies the recovery ID by applying EIP-155 to a v value.

source

fn with_parity_bool(self) -> Self
where Self: Copy,

Modifies the recovery ID by dropping any [EIP-155] v value, converting to a simple parity bool.

source

fn decode_rlp_vrs(buf: &mut &[u8]) -> Result<Self, Error>

Decode an RLP-encoded VRS signature.

source

fn rlp_rs_len(&self) -> usize

Length of RLP RS field encoding

source

fn rlp_vrs_len(&self) -> usize

Length of RLP V field encoding

source

fn write_rlp_rs(&self, out: &mut dyn BufMut)

Write R and S to an RLP buffer in progress.

source

fn write_rlp_v(&self, out: &mut dyn BufMut)

Write the V to an RLP buffer without using EIP-155.

source

fn write_rlp_vrs(&self, out: &mut dyn BufMut)

Write the VRS to the output. The V will always be 27 or 28.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

source§

impl EncodableSignature for Signature

source§

fn from_rs_and_parity<P: TryInto<Parity, Error = E>, E: Into<SignatureError>>( r: U256, s: U256, parity: P, ) -> Result<Self, SignatureError>

source§

fn r(&self) -> U256

source§

fn s(&self) -> U256

source§

fn v(&self) -> Parity

source§

fn with_parity<T: Into<Parity>>(self, parity: T) -> Self

Implementors§