-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(sdk): improve usability TxType
trait
#12548
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense.
though I think these functions should ideally be decoupled from type because the are also useful on the tx itself
/// 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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually not sure if we call these on the txtype itself, we def call them on the tx.
so I assume we could upstream these to alloy, probably as a standalone new trait
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have match statements on TxType
, which these would replace. Agree that they should be added to the tx trait too, along with the useful as_eipX -> Option<&tx>
methods
Ref #12454