From 500b0fac135fe07635d871d64467326599e2b27e Mon Sep 17 00:00:00 2001 From: Andrew Ar <118139478+siguint@users.noreply.github.com> Date: Thu, 10 Aug 2023 21:45:32 +0300 Subject: [PATCH] (feat):add transaction::is_dynamic_fee (#4152) --- crates/primitives/src/transaction/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/primitives/src/transaction/mod.rs b/crates/primitives/src/transaction/mod.rs index 8c7e0394c6..f63c6b9e1e 100644 --- a/crates/primitives/src/transaction/mod.rs +++ b/crates/primitives/src/transaction/mod.rs @@ -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`).