Skip to content

The method eth_maxPriorityFeePerGas does not exist/is not available #217

@PLKuba

Description

@PLKuba

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'}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions