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
{{ message }}
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
allowing to specify percentage-based factors (like 1.125 for 112.5%) (#7332)
* allowing to specify percentage-based factors (like 1.125 for 112.5%)
* added change log
* implemented with backward compatibility for any existing users
logic handled according to number or bigint
added unit test
* Adjusted method description
---------
Co-authored-by: I744506 <temirlan.basitov@sap.com>
Copy file name to clipboardexpand all lines: packages/web3-eth/src/web3_eth.ts
+59-37
Original file line number
Diff line number
Diff line change
@@ -272,43 +272,57 @@ export class Web3Eth extends Web3Context<Web3EthExecutionAPI, RegisteredSubscrip
272
272
}
273
273
274
274
/**
275
-
* Calculates the current Fee Data.
276
-
* If the node supports EIP-1559, then `baseFeePerGas` and `maxPriorityFeePerGas` will be returned along with the calculated `maxFeePerGas` value.
277
-
* `maxFeePerGas` is calculated as `baseFeePerGas` * `baseFeePerGasFactor` + `maxPriorityFeePerGas`.
278
-
* If the node does not support EIP-1559, then the `gasPrice` will be returned and the other values will be undefined.
279
-
*
280
-
* @param baseFeePerGasFactor (optional) The factor to multiply the `baseFeePerGas` with when calculating `maxFeePerGas`, if the node supports EIP-1559. The default value is 2.
281
-
* @param alternativeMaxPriorityFeePerGas (optional) The alternative `maxPriorityFeePerGas` to use when calculating `maxFeePerGas`, if the node supports EIP-1559, but does not support the method `eth_maxPriorityFeePerGas`. The default value is 1 gwei.
* If the node supports EIP-1559, then `baseFeePerGas` and `maxPriorityFeePerGas` will be returned along with the calculated `maxFeePerGas` value.
277
+
* `maxFeePerGas` is calculated as `baseFeePerGas` * `baseFeePerGasFactor` + `maxPriorityFeePerGas`.
278
+
* If the node does not support EIP-1559, then the `gasPrice` will be returned and the other values will be undefined.
279
+
*
280
+
* @param baseFeePerGasFactor (optional) The factor to multiply the `baseFeePerGas` with when calculating `maxFeePerGas`, if the node supports EIP-1559. This can be a `bigint` for precise calculation or a `number` to support decimals. The default value is 2 (BigInt).
281
+
* If a `number` is provided, it will be converted to `bigint` with three decimal precision.
282
+
* @param alternativeMaxPriorityFeePerGas (optional) The alternative `maxPriorityFeePerGas` to use when calculating `maxFeePerGas`, if the node supports EIP-1559 but does not support the method `eth_maxPriorityFeePerGas`. The default value is 1 gwei.
0 commit comments