Can you tell me what your response is by using this console
console.log(typeof tx.wait); console.log(tx);
I think .wait() might not be valid here due to the nature of the function.