mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
Added from<alloy_rpc_types_eth::Transaction> for TransactionSigned (#14350)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -24,7 +24,7 @@ alloy-network = { workspace = true, optional = true }
|
||||
alloy-consensus = { workspace = true, features = ["serde"] }
|
||||
alloy-serde = { workspace = true, optional = true }
|
||||
alloy-rlp.workspace = true
|
||||
alloy-rpc-types = { workspace = true, optional = true }
|
||||
alloy-rpc-types-eth = { workspace = true, optional = true }
|
||||
revm-primitives.workspace = true
|
||||
|
||||
# misc
|
||||
@ -54,7 +54,7 @@ test-utils = [
|
||||
"reth-codecs?/test-utils",
|
||||
"reth-primitives-traits/test-utils",
|
||||
]
|
||||
alloy-compat = ["dep:alloy-network", "dep:alloy-serde", "dep:alloy-rpc-types"]
|
||||
alloy-compat = ["dep:alloy-network", "dep:alloy-serde", "dep:alloy-rpc-types-eth"]
|
||||
std = [
|
||||
"alloy-consensus/std",
|
||||
"alloy-primitives/std",
|
||||
@ -67,6 +67,7 @@ std = [
|
||||
"secp256k1?/std",
|
||||
"revm-primitives/std",
|
||||
"alloy-serde?/std",
|
||||
"alloy-rpc-types-eth?/std",
|
||||
]
|
||||
reth-codec = [
|
||||
"std",
|
||||
@ -84,8 +85,8 @@ arbitrary = [
|
||||
"reth-primitives-traits/arbitrary",
|
||||
"alloy-eips/arbitrary",
|
||||
"revm-primitives/arbitrary",
|
||||
"alloy-rpc-types?/arbitrary",
|
||||
"alloy-serde?/arbitrary",
|
||||
"alloy-rpc-types-eth?/arbitrary",
|
||||
]
|
||||
serde-bincode-compat = [
|
||||
"alloy-consensus/serde-bincode-compat",
|
||||
|
||||
@ -4,13 +4,14 @@ use crate::{Transaction, TransactionSigned};
|
||||
use alloc::string::ToString;
|
||||
use alloy_consensus::TxEnvelope;
|
||||
use alloy_network::{AnyRpcTransaction, AnyTxEnvelope};
|
||||
use alloy_rpc_types_eth::Transaction as AlloyRpcTransaction;
|
||||
use alloy_serde::WithOtherFields;
|
||||
|
||||
impl TryFrom<AnyRpcTransaction> for TransactionSigned {
|
||||
type Error = alloy_rpc_types::ConversionError;
|
||||
type Error = alloy_rpc_types_eth::ConversionError;
|
||||
|
||||
fn try_from(tx: AnyRpcTransaction) -> Result<Self, Self::Error> {
|
||||
use alloy_rpc_types::ConversionError;
|
||||
use alloy_rpc_types_eth::ConversionError;
|
||||
|
||||
let WithOtherFields { inner: tx, other: _ } = tx;
|
||||
|
||||
@ -41,3 +42,12 @@ impl TryFrom<AnyRpcTransaction> for TransactionSigned {
|
||||
Ok(Self::new(transaction, signature, hash))
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> From<AlloyRpcTransaction<T>> for TransactionSigned
|
||||
where
|
||||
Self: From<T>,
|
||||
{
|
||||
fn from(value: AlloyRpcTransaction<T>) -> Self {
|
||||
value.inner.into()
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,6 @@
|
||||
issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/"
|
||||
)]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
@ -24,7 +24,3 @@ alloy-consensus.workspace = true
|
||||
# io
|
||||
serde.workspace = true
|
||||
jsonrpsee-types.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
alloy-rpc-types-engine = { workspace = true, features = ["serde"] }
|
||||
serde_json.workspace = true
|
||||
|
||||
Reference in New Issue
Block a user