diff --git a/web3/gas_strategies/rpc.py b/web3/gas_strategies/rpc.py index 23660ff3e2..22ffdb5073 100644 --- a/web3/gas_strategies/rpc.py +++ b/web3/gas_strategies/rpc.py @@ -5,9 +5,6 @@ from web3 import ( Web3, ) -from web3._utils.rpc_abi import ( - RPC, -) from web3.types import ( TxParams, Wei, @@ -20,4 +17,4 @@ def rpc_gas_price_strategy( """ A simple gas price strategy deriving it's value from the eth_gasPrice JSON-RPC call. """ - return w3.manager.request_blocking(RPC.eth_gasPrice, []) + return w3.eth.gas_price diff --git a/web3/middleware/gas_price_strategy.py b/web3/middleware/gas_price_strategy.py index 9abdfb6b28..29c20dabc2 100644 --- a/web3/middleware/gas_price_strategy.py +++ b/web3/middleware/gas_price_strategy.py @@ -7,6 +7,9 @@ from eth_utils.toolz import ( assoc, ) +from web3._utils.method_formatters import ( + to_integer_if_hex, +) from web3._utils.utility_methods import ( all_in_dict, @@ -45,7 +48,9 @@ def validate_transaction_params( and "gasPrice" not in transaction and none_in_dict(DYNAMIC_FEE_TXN_PARAMS, transaction) ): - transaction = assoc(transaction, "gasPrice", hex(strategy_based_gas_price)) + transaction = assoc( + transaction, "gasPrice", to_integer_if_hex(strategy_based_gas_price) + ) # legacy and dynamic fee tx variables used: if "gasPrice" in transaction and any_in_dict(DYNAMIC_FEE_TXN_PARAMS, transaction):