I'm a beginner with Web3 programming. Trying to understand how all it all works.
Managed to get some nodejs code working for buying tokens but when trying to create a script that sells tokens I get an error message related to the .buildTransaction method. I don't understand where I can get the buildTransaction method from? I guess it should go into the ABI same as for the swapExactTokensForETHSupportingFeeOnTransferTokens but I have looked everywhere and can't even find an example so it seems like I'm missing something.
Would really appreciate some help on this. Have been sitting 3 hours just trying to understand how I can get the buildTransaction to work.
My code:
exchange_txn = contract.functions.swapExactTokensForETHSupportingFeeOnTransferTokens(
500000000, 0,
[spending_this_token,buying_this_token],
your_wallet_address,
deadline
).buildTransaction({
'from': your_wallet_address,
'gasPrice': Web3Client.utils.toWei('20','gwei'),
'gasLimit': estimate,
'nonce': nonce,
})
Error message:
TypeError: contract.functions.swapExactTokensForETHSupportingFeeOnTransferTokens(...).buildTransaction is not a function