I'm trying to execute a contract call and set up the gas manually as the gas estimation is not working properly and is setting the gas too low. To do this I modified my send function to include this:
def send_txn(tx):
"""Very simple transaction function that returns the hash and the logs from the receipt after getting it back, hopefully within 60 seconds"""
tx['nonce'] = w3.eth.getTransactionCount(me)
tx['chainId'] = chain_id
#try:
# gasr = requests.get("https://api.debank.com/chain/gas_price_dict_v2?chain=avax",timeout=5)
# maxPriorityFeePerGas = int(gasr.json()['data']['fast']['price'])
# tx['maxPriorityFeePerGas'] = Web3.toWei('2.5', 'gwei')
# tx['maxFeePerGas'] = int(maxPriorityFeePerGas)+10*(10**9)
# tx['gas'] = 1000000
#except:
# print("Error setting gas")
signed = w3.eth.account.sign_transaction(tx, private_key)
txhash = Web3.toHex(w3.eth.send_raw_transaction(signed.rawTransaction))
receipt = w3.eth.wait_for_transaction_receipt(txhash, timeout=120)
return txhash, receipt['logs']
So I'm setting miner fee to 2.5 and max fee to whatever Debank's API returns + 10. I then call this function this way:
try:
txn = contract.functions.mint(me,2).buildTransaction()
hash, logs = send_txn(txn)
print(timenow + " - Minted")
except Exception as e:
print(f"Something broke with mint: {e}")
When that runs it seems to fail and enter the external except and it prints this error: Unknown kwargs: ['gasPrice']
Any idea what might be wrong?