The transaction is happening without any issue. The only problem is that I’m not able to get data back. I fixed it as I followed a different approach to notify the use about the transaction TX and receipt
const tx = await Moralis.executeFunction({
awaitReceipt: true,
...options,
});
console.log(tx.hash);
openNotification({
message: "Pending Transaction Transaction!",
description: "TX:" + tx.hash
});
// Wait until the transaction is confirmed
const receipt = await tx.wait();
openNotification({
message: "Transaction confirmed!",
description: ""
});
console.log(receipt)
Instead of
tx.on("transactionHash", (hash) => {
setResponses({
...responses,
[name]: { result: null, isLoading: true },
});
openNotification({
message: "🔊 New Transaction",
description: `${hash}`,
});
console.log("🔊 New Transaction", hash);
})
.on("receipt", (receipt) => {
setResponses({
...responses,
[name]: { result: null, isLoading: false },
});
openNotification({
message: "📃 New Receipt",
description: `${receipt.transactionHash}`,
});
console.log("🔊 New Receipt: ", receipt);
})
.on("error", (error) => {
console.error(error);
});