Skip to content

Commit

Permalink
(feat):add transaction::is_dynamic_fee (paradigmxyz#4152)
Browse files Browse the repository at this point in the history
  • Loading branch information
siguint authored Aug 10, 2023
1 parent 47bf60b commit 500b0fa
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/primitives/src/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,14 @@ impl Transaction {
}
}

/// Returns true if the tx supports dynamic fees
pub fn is_dynamic_fee(&self) -> bool {
match self {
Transaction::Legacy(_) | Transaction::Eip2930(_) => false,
Transaction::Eip1559(_) | Transaction::Eip4844(_) => true,
}
}

/// Max fee per gas for eip1559 transaction, for legacy transactions this is gas_price.
///
/// This is also commonly referred to as the "Gas Fee Cap" (`GasFeeCap`).
Expand Down

0 comments on commit 500b0fa

Please sign in to comment.