feat: add missing from impls (#13527)

This commit is contained in:
Matthias Seitz
2024-12-23 23:45:18 +01:00
committed by GitHub
parent c6d42ad8c4
commit 4c1208e9d9

View File

@ -4,7 +4,7 @@ use alloc::vec::Vec;
pub use alloy_consensus::transaction::PooledTransaction;
use alloy_consensus::{
transaction::RlpEcdsaTx, SignableTransaction, Signed, Transaction as _, TxEip1559, TxEip2930,
TxEip4844, TxEip4844Variant, TxEip4844WithSidecar, TxEip7702, TxLegacy, Typed2718,
TxEip4844, TxEip4844Variant, TxEip4844WithSidecar, TxEip7702, TxEnvelope, TxLegacy, Typed2718,
TypedTransaction,
};
use alloy_eips::{
@ -1465,6 +1465,26 @@ impl From<Signed<TxEip4844WithSidecar>> for TransactionSigned {
}
}
impl From<Signed<TxEip4844Variant>> for TransactionSigned {
fn from(value: Signed<TxEip4844Variant>) -> Self {
let (tx, sig, hash) = value.into_parts();
Self::new(tx.into(), sig, hash)
}
}
impl From<TxEnvelope> for TransactionSigned {
fn from(value: TxEnvelope) -> Self {
match value {
TxEnvelope::Legacy(tx) => tx.into(),
TxEnvelope::Eip2930(tx) => tx.into(),
TxEnvelope::Eip1559(tx) => tx.into(),
TxEnvelope::Eip4844(tx) => tx.into(),
TxEnvelope::Eip7702(tx) => tx.into(),
_ => unreachable!(),
}
}
}
impl From<TransactionSigned> for Signed<Transaction> {
fn from(value: TransactionSigned) -> Self {
let (tx, sig, hash) = value.into_parts();