feat: impl From alloy-consensus::TxType for reth_primitives::TxType (#10523)

This commit is contained in:
nk_ysg
2024-08-26 16:37:42 +08:00
committed by GitHub
parent 986e402fe6
commit 042faacb15
3 changed files with 14 additions and 0 deletions

1
Cargo.lock generated
View File

@ -8126,6 +8126,7 @@ dependencies = [
name = "reth-primitives" name = "reth-primitives"
version = "1.0.5" version = "1.0.5"
dependencies = [ dependencies = [
"alloy-consensus",
"alloy-eips", "alloy-eips",
"alloy-genesis", "alloy-genesis",
"alloy-primitives", "alloy-primitives",

View File

@ -27,6 +27,7 @@ alloy-rlp = { workspace = true, features = ["arrayvec"] }
alloy-rpc-types = { workspace = true, optional = true } alloy-rpc-types = { workspace = true, optional = true }
alloy-genesis.workspace = true alloy-genesis.workspace = true
alloy-eips = { workspace = true, features = ["serde"] } alloy-eips = { workspace = true, features = ["serde"] }
alloy-consensus.workspace = true
# crypto # crypto
secp256k1 = { workspace = true, features = [ secp256k1 = { workspace = true, features = [

View File

@ -220,6 +220,18 @@ impl Decodable for TxType {
} }
} }
impl From<alloy_consensus::TxType> for TxType {
fn from(value: alloy_consensus::TxType) -> Self {
match value {
alloy_consensus::TxType::Legacy => Self::Legacy,
alloy_consensus::TxType::Eip2930 => Self::Eip2930,
alloy_consensus::TxType::Eip1559 => Self::Eip1559,
alloy_consensus::TxType::Eip4844 => Self::Eip4844,
//alloy_consensus::TxType::Eip7702 => Self::Eip7702,
}
}
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::hex; use crate::hex;