mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +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:
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -7599,7 +7599,7 @@ dependencies = [
|
|||||||
"alloy-network",
|
"alloy-network",
|
||||||
"alloy-primitives",
|
"alloy-primitives",
|
||||||
"alloy-rlp",
|
"alloy-rlp",
|
||||||
"alloy-rpc-types",
|
"alloy-rpc-types-eth",
|
||||||
"alloy-serde",
|
"alloy-serde",
|
||||||
"arbitrary",
|
"arbitrary",
|
||||||
"bincode",
|
"bincode",
|
||||||
@ -9238,13 +9238,11 @@ version = "1.1.5"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"alloy-consensus",
|
"alloy-consensus",
|
||||||
"alloy-primitives",
|
"alloy-primitives",
|
||||||
"alloy-rpc-types-engine",
|
|
||||||
"alloy-rpc-types-eth",
|
"alloy-rpc-types-eth",
|
||||||
"jsonrpsee-types",
|
"jsonrpsee-types",
|
||||||
"reth-primitives",
|
"reth-primitives",
|
||||||
"reth-primitives-traits",
|
"reth-primitives-traits",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
@ -24,7 +24,7 @@ alloy-network = { workspace = true, optional = true }
|
|||||||
alloy-consensus = { workspace = true, features = ["serde"] }
|
alloy-consensus = { workspace = true, features = ["serde"] }
|
||||||
alloy-serde = { workspace = true, optional = true }
|
alloy-serde = { workspace = true, optional = true }
|
||||||
alloy-rlp.workspace = true
|
alloy-rlp.workspace = true
|
||||||
alloy-rpc-types = { workspace = true, optional = true }
|
alloy-rpc-types-eth = { workspace = true, optional = true }
|
||||||
revm-primitives.workspace = true
|
revm-primitives.workspace = true
|
||||||
|
|
||||||
# misc
|
# misc
|
||||||
@ -54,7 +54,7 @@ test-utils = [
|
|||||||
"reth-codecs?/test-utils",
|
"reth-codecs?/test-utils",
|
||||||
"reth-primitives-traits/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 = [
|
std = [
|
||||||
"alloy-consensus/std",
|
"alloy-consensus/std",
|
||||||
"alloy-primitives/std",
|
"alloy-primitives/std",
|
||||||
@ -67,6 +67,7 @@ std = [
|
|||||||
"secp256k1?/std",
|
"secp256k1?/std",
|
||||||
"revm-primitives/std",
|
"revm-primitives/std",
|
||||||
"alloy-serde?/std",
|
"alloy-serde?/std",
|
||||||
|
"alloy-rpc-types-eth?/std",
|
||||||
]
|
]
|
||||||
reth-codec = [
|
reth-codec = [
|
||||||
"std",
|
"std",
|
||||||
@ -84,8 +85,8 @@ arbitrary = [
|
|||||||
"reth-primitives-traits/arbitrary",
|
"reth-primitives-traits/arbitrary",
|
||||||
"alloy-eips/arbitrary",
|
"alloy-eips/arbitrary",
|
||||||
"revm-primitives/arbitrary",
|
"revm-primitives/arbitrary",
|
||||||
"alloy-rpc-types?/arbitrary",
|
|
||||||
"alloy-serde?/arbitrary",
|
"alloy-serde?/arbitrary",
|
||||||
|
"alloy-rpc-types-eth?/arbitrary",
|
||||||
]
|
]
|
||||||
serde-bincode-compat = [
|
serde-bincode-compat = [
|
||||||
"alloy-consensus/serde-bincode-compat",
|
"alloy-consensus/serde-bincode-compat",
|
||||||
|
|||||||
@ -4,13 +4,14 @@ use crate::{Transaction, TransactionSigned};
|
|||||||
use alloc::string::ToString;
|
use alloc::string::ToString;
|
||||||
use alloy_consensus::TxEnvelope;
|
use alloy_consensus::TxEnvelope;
|
||||||
use alloy_network::{AnyRpcTransaction, AnyTxEnvelope};
|
use alloy_network::{AnyRpcTransaction, AnyTxEnvelope};
|
||||||
|
use alloy_rpc_types_eth::Transaction as AlloyRpcTransaction;
|
||||||
use alloy_serde::WithOtherFields;
|
use alloy_serde::WithOtherFields;
|
||||||
|
|
||||||
impl TryFrom<AnyRpcTransaction> for TransactionSigned {
|
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> {
|
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;
|
let WithOtherFields { inner: tx, other: _ } = tx;
|
||||||
|
|
||||||
@ -41,3 +42,12 @@ impl TryFrom<AnyRpcTransaction> for TransactionSigned {
|
|||||||
Ok(Self::new(transaction, signature, hash))
|
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/"
|
issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/"
|
||||||
)]
|
)]
|
||||||
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||||
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
|
|
||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
|
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
|
|||||||
@ -24,7 +24,3 @@ alloy-consensus.workspace = true
|
|||||||
# io
|
# io
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
jsonrpsee-types.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