#![doc = include_str!("../README.md")]
#![doc(
html_logo_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/alloy.jpg",
html_favicon_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/favicon.ico"
)]
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
mod error;
pub use error::{Error, Result, UnsupportedSignerOperation};
mod signer;
pub use signer::{Signer, SignerSync};
pub mod utils;
pub use alloy_primitives::Signature;
pub use k256;
#[macro_export]
macro_rules! sign_transaction_with_chain_id {
($signer:expr, $tx:expr, $sign:expr) => {{
if let Some(chain_id) = $signer.chain_id() {
if !$tx.set_chain_id_checked(chain_id) {
return Err(alloy_signer::Error::TransactionChainIdMismatch {
signer: chain_id,
tx: $tx.chain_id().unwrap(),
});
}
}
$sign.map_err(alloy_signer::Error::other)
}};
}