Not getting response for walletconnect and Moralis.executeFunction

Hi, I think that the functionality was added, can you try now?

i have exactly the same issue. the call functions all work. but the send functions donā€™t with walletconnect.

const receipt = await Moralis.executeFunction(options);
console.log(receipt)

this code just executes nothing for meā€¦

I think that you should use events, events should work in latest Moralis sdk version, but that code should still send the transaction.

what do you mean? what events should i be using?


const tx = await Moralis.executeFunction(options);

tx.on("transactionHash", (hash) => { console.log(hash) })
  .on("receipt", (receipt) => { console.log(receipt) })
  .on("confirmation", (confirmationNumber, receipt) => { console.log(confirmationNumber,receipt) })
  .on("error", (error) => { console.log(error) });

Can you try this and see if any of these events fire and print to console (transactionHash, receipt etc)

It shows nothing in the consoleā€¦ when I use walletconnect with either metamast or trustwallet. I can connect. It does perform a read call. But when I make a transaction. Mrtamask/trustwallet doesnā€™t even open. Just nothing happens when I click the button. With normal mrtamask login. Everything does work.
I used https://docs.moralis.io/moralis-server/web3/web3 to make the dapp

can you share what you passed as options? did you use awaitReceipt = false?

const options = {
    contractAddress: "0xf684a651674046ce211b4956235ac001a96b3333",
    functionName: "mintForUser",
    abi: ABI,
    params: {
      user: address
    },
  };
  const tx = await Moralis.executeFunction(options);

tx.on("transactionHash", (hash) => { console.log(hash) })
  .on("receipt", (receipt) => { console.log(receipt) })
  .on("confirmation", (confirmationNumber, receipt) => { console.log(confirmationNumber,receipt) })
  .on("error", (error) => { console.log(error) });

This is the code i used. (ABI is the whole ABI)
For metamask login it works perfectly. But with walletconnect, the wallet doesnā€™t even open when I start this function.

can you try a syntax similar to this one?

mainly using awaitReceipt = false and using Moralis.enableWeb3({ provider: 'walletconnect' })

Yup. Same thing with awaitReceipt: false. Nothing shows up in console. And trustwallet doesnā€™t open with the transaction. Just a button and nothing happensā€¦

Iā€™ll need some time to test it, can you share a minimal html + js example that doesnā€™t work for you?

Wait i think I found something. Is there a function on how to check which provider is used?
So I can make an if function. If provider of connected = trustwallet. Do this
Else do this

I think that you can identify if it is wallet connect or not: Moralis authenticate ios/ android / trustwallet and more

for trust wallet in particular, you may get in another problem later: Wallet connect takes me to trust wallet page

const provider = window.localStorage.walletconnect ? "walletconnect": "Metamask";

if i first connect with walletconnect. and then disconnect and connect with metamask. it gives me walletconnect as outputā€¦

when i clear my cookies and i use metamask. it returns metamask. but when i first use walletconnect. then refresh and connect with metamask (without clearing cookies) i only get walletconnect as output.

you could try to remove that item from localStorage before connecting:

window.localStorage.removeItem('walletconnect');

window.localStorage.removeItem(
  'WALLETCONNECT_DEEPLINK_CHOICE'
);

yeah i got it working by using a public variable for the address. that was the problem. but when i use

tx.on("transactionHash", (hash) => { console.log(hash) })
  .on("receipt", (receipt) => { console.log(receipt) })
  .on("confirmation", (confirmationNumber, receipt) => { console.log(confirmationNumber,receipt) })
  .on("error", (error) => { console.log(error) });

with awaitReceipt: false
i only get the transactionHash in console. nothing elseā€¦ although the transaction has already completed

1 Like

Great that it works!!

Hey @tcvdh

Iā€™ve done some tests and I have the same problem. Iā€™ll let you know when we will find a solution :raised_hands:

@Yomoo which problem exactlyšŸ˜…. i encountered multiplešŸ˜‚

Thatā€™s why there is a rule : ā€œOne problem - one threadā€.

Iā€™m speaking about receipts from WalletConnect