Trait alloy_signer::SignerSync

source ·
pub trait SignerSync<Sig = PrimitiveSignature> {
    // Required methods
    fn sign_hash_sync(&self, hash: &B256) -> Result<Sig>;
    fn chain_id_sync(&self) -> Option<ChainId>;

    // Provided method
    fn sign_message_sync(&self, message: &[u8]) -> Result<Sig> { ... }
}
Expand description

Synchronous Ethereum signer.

All provided implementations rely on sign_hash_sync. A signer may not always be able to implement this method, in which case it should return UnsupportedOperation, and implement all the signing methods directly.

Synchronous signers should also implement Signer, as they are always able to by delegating the asynchronous methods to the synchronous ones.

Required Methods§

source

fn sign_hash_sync(&self, hash: &B256) -> Result<Sig>

Signs the given hash.

source

fn chain_id_sync(&self) -> Option<ChainId>

Returns the signer’s chain ID.

Provided Methods§

source

fn sign_message_sync(&self, message: &[u8]) -> Result<Sig>

Signs the hash of the provided message after prefixing it, as specified in EIP-191.

Implementations on Foreign Types§

source§

impl<'a, Sig, U: 'a + SignerSync<Sig> + ?Sized> SignerSync<Sig> for &'a U

source§

fn sign_hash_sync(&self, hash: &B256) -> Result<Sig>

source§

fn sign_message_sync(&self, message: &[u8]) -> Result<Sig>

source§

fn chain_id_sync(&self) -> Option<ChainId>

source§

impl<'a, Sig, U: 'a + SignerSync<Sig> + ?Sized> SignerSync<Sig> for &'a mut U

source§

fn sign_hash_sync(&self, hash: &B256) -> Result<Sig>

source§

fn sign_message_sync(&self, message: &[u8]) -> Result<Sig>

source§

fn chain_id_sync(&self) -> Option<ChainId>

source§

impl<Sig, U: SignerSync<Sig> + ?Sized> SignerSync<Sig> for Box<U>

source§

fn sign_hash_sync(&self, hash: &B256) -> Result<Sig>

source§

fn sign_message_sync(&self, message: &[u8]) -> Result<Sig>

source§

fn chain_id_sync(&self) -> Option<ChainId>

source§

impl<Sig, U: SignerSync<Sig> + ?Sized> SignerSync<Sig> for Rc<U>

source§

fn sign_hash_sync(&self, hash: &B256) -> Result<Sig>

source§

fn sign_message_sync(&self, message: &[u8]) -> Result<Sig>

source§

fn chain_id_sync(&self) -> Option<ChainId>

source§

impl<Sig, U: SignerSync<Sig> + ?Sized> SignerSync<Sig> for Arc<U>

source§

fn sign_hash_sync(&self, hash: &B256) -> Result<Sig>

source§

fn sign_message_sync(&self, message: &[u8]) -> Result<Sig>

source§

fn chain_id_sync(&self) -> Option<ChainId>

Implementors§