(feat):add transaction::is_dynamic_fee (#4152)

This commit is contained in:
Andrew Ar
2023-08-10 21:45:32 +03:00
committed by GitHub
parent 47bf60be61
commit 500b0fac13

View File

@@ -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`).