pub struct Signer { /* private fields */ }Expand description
EVM transaction signer.
Wraps a PrivateKeySigner with Deref for full alloy API access.
The inner k256::SigningKey implements ZeroizeOnDrop.
§Examples
use signer_evm::{Signer, SignerSync};
let signer = Signer::random();
let sig = signer.sign_message_sync(b"hello").unwrap();Implementations§
Source§impl Signer
impl Signer
Sourcepub fn from_bytes(bytes: &B256) -> Result<Self, Error>
pub fn from_bytes(bytes: &B256) -> Result<Self, Error>
Create a signer from a raw 32-byte private key.
§Errors
Returns an error if the bytes do not represent a valid secp256k1 private key.
Sourcepub fn from_hex(hex_str: &str) -> Result<Self, Error>
pub fn from_hex(hex_str: &str) -> Result<Self, Error>
Create a signer from a hex-encoded private key.
Accepts keys with or without 0x prefix.
Compatible with [kobe_evm::DerivedAddress::private_key_hex] output.
§Errors
Returns an error if the hex string is invalid or the key is not a valid secp256k1 private key.
Sourcepub fn into_inner(self) -> PrivateKeySigner
pub fn into_inner(self) -> PrivateKeySigner
Consume the wrapper and return the inner PrivateKeySigner.
Trait Implementations§
Source§impl Deref for Signer
impl Deref for Signer
Source§type Target = LocalSigner<SigningKey<Secp256k1>>
type Target = LocalSigner<SigningKey<Secp256k1>>
The resulting type after dereferencing.
Source§impl From<LocalSigner<SigningKey<Secp256k1>>> for Signer
impl From<LocalSigner<SigningKey<Secp256k1>>> for Signer
Source§fn from(inner: PrivateKeySigner) -> Self
fn from(inner: PrivateKeySigner) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Signer
impl RefUnwindSafe for Signer
impl Send for Signer
impl Sync for Signer
impl Unpin for Signer
impl UnsafeUnpin for Signer
impl UnwindSafe for Signer
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 more