[SOLVED] Try to send ERC20 tokens Wallet Connect


This is my code for sending ERC20 tokens:

  async function sendTokens() {
    const options = {
      type: "erc20",
      amount: Moralis.Units.Token("5", "18"),
      contractAddress: "0x....",
      receiver: "0x...",
      awaitReceipt: false
    let result = await Moralis.transfer(options)
    result.on("receipt", (receipt) => console.log(receipt))
      .on("transactionHash", (hash) => console.log(hash))

It works great with Metamask on test (BSC test net) and real BSC.


When I want to use WalletConnect to send tokens, then I go through authentication (scan the QR code using my smartphone) and connect successfully.

When I want to send tokens and call the code that I attached, nothing happens.

I am online almost always and look forward to your reply or help.
I will provide any additional data from my web application upon request! Thanks!

Hi @blackwater

Please share the function you use for the web3 activating

currentProvider is string “walletconnect”

  async function authenticate() {
    try {
      user = await Moralis.authenticate({provider: currentProvider});
      web3 = await Moralis.enableWeb3({provider: currentProvider});
    } catch (error) {
      console.log('authenticate failed', error);

p.s. Authentication stopped working now

To scan the walletconnect QR code I use the Metamask mobile application

Even if you try to logout?

Please add a try/catch block for the transfer function, do you get any warnings?

WC sometimes doesn’t work correctly on Vanilla Js :cry:

I will try to describe in more detail what is happening in my web application.

I have a function that I call to authenticate and then transfer erc20.
On a desktop using metamask - everything is ok.
As soon as I want to use walletconnect, problems begin.

By scanning qr code using metamask app - sometimes in app
he offers me to undergo an authentication. Yesterday I had the opportunity to send tokens. I haven’t touched my code …

I’m just trying to figure out if there are any differences between connect / transfer tokens when I use metamask or walletconnect?

Could there be a difference in the network I am using?

Also, using the ‘1inch’ application to scan the qr-code, I can pass the anti-infection BUT in the application itself, I am informed that my Dapp is on the Ethereum network and not in the BSC. After switching to ETH, I can get authenticated…

does not issue warnings…

I can’t log out because I haven’t logged in yet)

Thank you, the topic can be closed!

The problem was that I was not passing chainId to the enableWeb3 function.

If you are using anything instead of metamask,
besides the provider, you need to pass the ‘chainId’ parameter.

At the same time for work only
with metamask - ‘chainId’, as I understand it, is not required.

Working example:

web3 = await Moralis.enableWeb3({provider: "metamask", chainId: 56});