mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
impl TryFrom<alloy_rpc_types::Transaction> for TransactionSignedNoHash (#9823)
This commit is contained in:
@ -2,8 +2,8 @@
|
||||
|
||||
use crate::{
|
||||
constants::EMPTY_TRANSACTIONS, transaction::extract_chain_id, Block, Signature, Transaction,
|
||||
TransactionSigned, TransactionSignedEcRecovered, TxEip1559, TxEip2930, TxEip4844, TxLegacy,
|
||||
TxType,
|
||||
TransactionSigned, TransactionSignedEcRecovered, TransactionSignedNoHash, TxEip1559, TxEip2930,
|
||||
TxEip4844, TxLegacy, TxType,
|
||||
};
|
||||
use alloy_primitives::TxKind;
|
||||
use alloy_rlp::Error as RlpError;
|
||||
@ -296,6 +296,17 @@ impl TryFrom<alloy_rpc_types::Signature> for Signature {
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<alloy_rpc_types::Transaction> for TransactionSignedNoHash {
|
||||
type Error = alloy_rpc_types::ConversionError;
|
||||
|
||||
fn try_from(tx: alloy_rpc_types::Transaction) -> Result<Self, Self::Error> {
|
||||
Ok(Self {
|
||||
signature: tx.signature.ok_or(Self::Error::MissingSignature)?.try_into()?,
|
||||
transaction: tx.try_into()?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(feature = "optimism")]
|
||||
mod tests {
|
||||
|
||||
Reference in New Issue
Block a user