You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pkg/transaction/wrapped/fee.go
+29-5Lines changed: 29 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -20,20 +20,44 @@ var (
20
20
ErrEIP1559NotSupported=errors.New("network does not appear to support EIP-1559 (no baseFee)")
21
21
)
22
22
23
-
// SuggestedFeeAndTip calculates the recommended gasFeeCap and gasTipCap for a transaction.
23
+
// SuggestedFeeAndTip calculates the recommended gasFeeCap (maxFeePerGas) and gasTipCap (maxPriorityFeePerGas) for a transaction.
24
+
// If gasPrice is provided (legacy mode):
25
+
// - On EIP-1559 networks: gasFeeCap = gasPrice; gasTipCap = max(gasPrice - baseFee, minimumTip) to respect the total cap while enforcing a tip floor where possible.
26
+
// - On pre-EIP-1559 networks: returns (gasPrice, gasPrice) for legacy transaction compatibility.
27
+
//
28
+
// If gasPrice is nil: Uses suggested tip with optional boost, enforces minimum, and sets gasFeeCap = 2 * baseFee + gasTipCap.
0 commit comments