Repository navigation
The method eth_maxPriorityFeePerGas does not exist/is not available #217
Copy link
Copy link
Closed
Description
Hi,
I'm trying to perform a swap on spookyswap (fantom chain) using Uniswap-python.
However, I'm getting the following ValueError:
ValueError: {'code': -32601, 'message': 'the method eth_maxPriorityFeePerGas does not exist/is not available'}
I tried using multiple RPCs but all of them gave the same output.
NOTE:
I modified _netid_to_name in constats.py so that chainId 250 (fantom) is acceptable.
Code:
from uniswap import Uniswap
fantom_provider = 'https://rpc.ftm.tools/'
spookyswap_router_contract_addr = "0xf491e7b69e4244ad4002bc14e878a34207e38c29"
spookyswap_factory_contract_addr = "0x152eE697f2E276fA89E96742e9bB9aB1F2E61bE3"
weth_ftm = "0x74b23882a30290451A17c44f4F05243b6b58C76d"
dai_ftm = "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e"
amount = 0.00000001
spookyswap = Uniswap(address=spookyswap_address, private_key=spookyswap_private_key, version=version,
router_contract_addr=spookyswap_router_contract_addr,
factory_contract_addr=spookyswap_factory_contract_addr,
provider=fantom_provider)
spookyswap.make_trade(weth_ftm, dai_ftm, int(amount * 10**18), slippage = 0.2)Full Error message:
Approving 0x74b23882a30290451A17c44f4F05243b6b58C76d...
Traceback (most recent call last):
File "/Users/kuba/PycharmProjects/project/playground.py", line 111, in <module>
print(spookyswap.make_trade(weth_ftm, dai_ftm, int(amount * 10**18), slippage = 0.2))
File "/Users/kuba/PycharmProjects/project/venv/lib/python3.9/site-packages/uniswap/decorators.py", line 29, in approved
self.approve(token)
File "/Users/kuba/PycharmProjects/project/venv/lib/python3.9/site-packages/uniswap/uniswap.py", line 1053, in approve
tx = self._build_and_send_tx(function)
File "/Users/kuba/PycharmProjects/project/venv/lib/python3.9/site-packages/uniswap/uniswap.py", line 1087, in _build_and_send_tx
transaction = function.buildTransaction(tx_params)
File "/Users/kuba/PycharmProjects/project/venv/lib/python3.9/site-packages/web3/contract.py", line 1079, in buildTransaction
return build_transaction_for_function(
File "/Users/kuba/PycharmProjects/project/venv/lib/python3.9/site-packages/web3/contract.py", line 1648, in build_transaction_for_function
prepared_transaction = fill_transaction_defaults(web3, prepared_transaction)
File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
File "/Users/kuba/PycharmProjects/project/venv/lib/python3.9/site-packages/web3/_utils/transactions.py", line 121, in fill_transaction_defaults
default_val = default_getter(web3, transaction)
File "/Users/kuba/PycharmProjects/project/venv/lib/python3.9/site-packages/web3/_utils/transactions.py", line 71, in <lambda>
web3.eth.max_priority_fee + (2 * web3.eth.get_block('latest')['baseFeePerGas'])
File "/Users/kuba/PycharmProjects/project/venv/lib/python3.9/site-packages/web3/eth.py", line 549, in max_priority_fee
return self._max_priority_fee()
File "/Users/kuba/PycharmProjects/project/venv/lib/python3.9/site-packages/web3/module.py", line 57, in caller
result = w3.manager.request_blocking(method_str,
File "/Users/kuba/PycharmProjects/project/venv/lib/python3.9/site-packages/web3/manager.py", line 198, in request_blocking
return self.formatted_response(response,
File "/Users/kuba/PycharmProjects/project/venv/lib/python3.9/site-packages/web3/manager.py", line 171, in formatted_response
raise ValueError(response["error"])
ValueError: {'code': -32601, 'message': 'the method eth_maxPriorityFeePerGas does not exist/is not available'}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
liquid-8 commentedon Dec 16, 2021
Please check what
web3pyversion you use.PLKuba commentedon Dec 16, 2021
5.25.0
liquid-8 commentedon Dec 17, 2021
#216 (comment)
PLKuba commentedon Dec 18, 2021
I modified TRANSACTION_DEFAULTS in transactions.py
Now it looks like this, but I end up with an error while sending a transaction:
liquid-8 commentedon Dec 18, 2021
Let's try the easier way. Rollback these changes, then here
uniswap-python/uniswap/uniswap.py
Line 1108 in fa9836e
change
_get_tx_params()to thisIt should work. Otherwise, you'll need to add a couple of lines to this snippet, but I doubt it.
PLKuba commentedon Dec 18, 2021
I rolled back changes and still, I'm getting the same error as initially:
liquid-8 commentedon Dec 18, 2021
Ok, then this way
Of course, you may hardcode some values first just to test this snippet. If it still doesn't work, then their devs have made some significant changes.
PLKuba commentedon Dec 18, 2021
EDIT: works fine now. This solved it. Thanks!
Unfortunately I got an error while signing the transaction : (
jemkein commentedon Dec 19, 2021
Hi,
I get the same Error and Tried both solutions.
#217 (comment) fixes my Problem, the other doesn't.
But now I get "TypeError: Unknown Transaction type: 0"
Did you fix your Error while signing the Transaction?
I am trying to use Pancakeswap (BSC)