0

Below is my attempt at constructing a transaction on Fantom

(Keep in mind that Fantom is not EIP-1559 compatible, so the format should be the old one)

contract_txn = contract_SPOOKY_ROUTER.functions.swapExactTokensForTokens(Web3.toWei(1.2, 'ether'), 0, path , address_wallet, block['timestamp']+60 ).buildTransaction({
                                'type': '0x2',
                                'chainId':  250,    # FTM 
                               # 'value' : Web3.toWei(1.5, 'ether'),
                                'gas': 200000,
                                'gasPrice': Web3.toWei('200', 'gwei'),
                                'nonce': nonce,
    })
signed = w3.eth.account.sign_transaction(contract_txn, privatekey)
w3.eth.send_raw_transaction(signed.rawTransaction)
nonce += 1

When I run this, I end up with the following error message.

    raise TypeError("Unknown kwargs: {0}".format(sorted(unknown_kwargs)))
TypeError: Unknown kwargs: ['gasPrice']

I am having a hard time figuring out where I made a mistake.

1 Answer 1

0

Type 2 is for EIP-1559 London fork. Use maxFeePerGas and maxPriorityFeePerGas, when using type 2. If the chain doesn't support it, remove type parameter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.