diff --git a/Cargo.toml b/Cargo.toml index 7b741bb..f282507 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,9 @@ alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "52d16d3" alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "52d16d3" } alloy-transport = { git = "https://github.com/alloy-rs/alloy", rev = "52d16d3" } alloy-transport-http = { git = "https://github.com/alloy-rs/alloy", rev = "52d16d3" } -alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "52d16d3" } +alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "52d16d3", features = [ + "k256", +] } alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "52d16d3" } alloy-primitives = "0.6.4" url = "2.5.0" diff --git a/src/tx.rs b/src/tx.rs index 6390659..0e4abba 100644 --- a/src/tx.rs +++ b/src/tx.rs @@ -104,6 +104,15 @@ impl ConsensusTx { } } + pub fn sender(&self) -> Result { + match &self.0 { + TxEnvelope::Legacy(tx) => tx.recover_signer(), + TxEnvelope::Eip2930(tx) => tx.recover_signer(), + TxEnvelope::Eip1559(tx) => tx.recover_signer(), + TxEnvelope::Eip4844(tx) => tx.recover_signer(), + } + } + pub fn chain_id(&self) -> Option { match &self.0 { TxEnvelope::Legacy(tx) => tx.tx().chain_id(),