Skip to content

Commit

Permalink
feat: add missing from impls
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Dec 23, 2024
1 parent ec21e89 commit 812b96e
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion crates/primitives/src/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 812b96e

Please sign in to comment.