-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use
reth-ethereum-primitives
(#13830)
- Loading branch information
Showing
67 changed files
with
941 additions
and
3,025 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
//! Common conversions from alloy types. | ||
use crate::{Transaction, TransactionSigned}; | ||
use alloc::string::ToString; | ||
use alloy_consensus::TxEnvelope; | ||
use alloy_network::{AnyRpcTransaction, AnyTxEnvelope}; | ||
use alloy_serde::WithOtherFields; | ||
|
||
impl TryFrom<AnyRpcTransaction> for TransactionSigned { | ||
type Error = alloy_rpc_types::ConversionError; | ||
|
||
fn try_from(tx: AnyRpcTransaction) -> Result<Self, Self::Error> { | ||
use alloy_rpc_types::ConversionError; | ||
|
||
let WithOtherFields { inner: tx, other: _ } = tx; | ||
|
||
#[allow(unreachable_patterns)] | ||
let (transaction, signature, hash) = match tx.inner { | ||
AnyTxEnvelope::Ethereum(TxEnvelope::Legacy(tx)) => { | ||
let (tx, signature, hash) = tx.into_parts(); | ||
(Transaction::Legacy(tx), signature, hash) | ||
} | ||
AnyTxEnvelope::Ethereum(TxEnvelope::Eip2930(tx)) => { | ||
let (tx, signature, hash) = tx.into_parts(); | ||
(Transaction::Eip2930(tx), signature, hash) | ||
} | ||
AnyTxEnvelope::Ethereum(TxEnvelope::Eip1559(tx)) => { | ||
let (tx, signature, hash) = tx.into_parts(); | ||
(Transaction::Eip1559(tx), signature, hash) | ||
} | ||
AnyTxEnvelope::Ethereum(TxEnvelope::Eip4844(tx)) => { | ||
let (tx, signature, hash) = tx.into_parts(); | ||
(Transaction::Eip4844(tx.into()), signature, hash) | ||
} | ||
AnyTxEnvelope::Ethereum(TxEnvelope::Eip7702(tx)) => { | ||
let (tx, signature, hash) = tx.into_parts(); | ||
(Transaction::Eip7702(tx), signature, hash) | ||
} | ||
_ => return Err(ConversionError::Custom("unknown transaction type".to_string())), | ||
}; | ||
|
||
Ok(Self { transaction, signature, hash: hash.into() }) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,6 @@ pub use receipt::*; | |
|
||
mod transaction; | ||
pub use transaction::*; | ||
|
||
#[cfg(feature = "alloy-compat")] | ||
mod alloy_compat; |
Oops, something went wrong.