1#![doc = include_str!("../README.md")]
2#![doc(
3 html_logo_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/alloy.jpg",
4 html_favicon_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/favicon.ico"
5)]
6#![cfg_attr(not(test), warn(unused_crate_dependencies))]
7#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
8
9mod error;
10pub use error::{Error, Result, UnsupportedSignerOperation};
11
12mod signer;
13pub use signer::{Either, Signer, SignerSync};
14
15pub mod utils;
16
17pub use alloy_primitives::Signature;
18pub use k256;
19
20#[macro_export]
23macro_rules! sign_transaction_with_chain_id {
24 ($signer:expr, $tx:expr, $sign:expr) => {{
30 if let Some(chain_id) = $signer.chain_id() {
31 if !$tx.set_chain_id_checked(chain_id) {
32 return Err(alloy_signer::Error::TransactionChainIdMismatch {
33 signer: chain_id,
34 tx: $tx.chain_id().unwrap(),
36 });
37 }
38 }
39
40 $sign.map_err(alloy_signer::Error::other)
41 }};
42}