chore(sdk): improve usability TxType trait (#12548)

This commit is contained in:
Emilia Hane
2024-11-15 14:31:35 +01:00
committed by GitHub
parent 56826cbdbb
commit 5f66fa448e
6 changed files with 74 additions and 24 deletions

View File

@ -30,26 +30,18 @@ pub trait TxType:
+ alloy_rlp::Encodable
+ alloy_rlp::Decodable
{
}
/// Returns `true` if this is a legacy transaction.
fn is_legacy(&self) -> bool;
impl<T> TxType for T where
T: Send
+ Sync
+ Unpin
+ Clone
+ Copy
+ Default
+ fmt::Debug
+ fmt::Display
+ PartialEq
+ Eq
+ PartialEq<u8>
+ Into<u8>
+ Into<U8>
+ TryFrom<u8, Error: fmt::Debug>
+ TryFrom<u64, Error: fmt::Debug>
+ TryFrom<U64>
+ alloy_rlp::Encodable
+ alloy_rlp::Decodable
{
/// Returns `true` if this is an eip-2930 transaction.
fn is_eip2930(&self) -> bool;
/// Returns `true` if this is an eip-1559 transaction.
fn is_eip1559(&self) -> bool;
/// Returns `true` if this is an eip-4844 transaction.
fn is_eip4844(&self) -> bool;
/// Returns `true` if this is an eip-7702 transaction.
fn is_eip7702(&self) -> bool;
}