I approved the token for spending still have my TX failing, im using this code to create the tx:
path = [spend, receive]
tx_params = {
'from': sender_address,
'gas': 250000,
'gasPrice': web3.toWei('35', 'gwei'),
'value': 0,
'nonce': web3.eth.getTransactionCount(sender_address)
}
print(tx_params)
function = contract.functions.swapExactTokensForTokens(
weiSpend,
weiReceiveMin,
path,
sender_address,
int(time.time()) + 100 * 60)
print(function)
transaction = function.buildTransaction(tx_params)
signed_txn = web3.eth.account.sign_transaction(
transaction, private_key=private
)
tx_token = web3.eth.send_raw_transaction(signed_txn.rawTransaction)
print(web3.toHex(tx_token))
Oct 30, 2021, 3:32 PM