Walletconnect to send USDT ERC20

795 Views Asked by At

In my app I am showing wallet connect QR modal to allow mobile based wallets, connect with my DApp. I was able to scan and connect the app with various mobile wallets like omni, rainbow, trust wallet. I am trying to transfer USDT(USDT-ERC20) to the receiver address and below is the code I have implemeted:

  async function TransferUSDT() {
    let provider = new WalletConnectProvider({
      rpc: {
        1: "https://cloudflare-eth.com/"
      }
    });
    await provider.enable();
    const web3 = new Web3(provider);
    const contractAddress = "0xdAC17F958D2ee523a2206206994597C13D831ec7";
    const contract = new web3.eth.Contract(abi, contractAddress, {
      gasLimit: "46085",
      gasPrice: "16747612334"
    });
    contract.methods
      .transfer(destinationAdrs, "1000000")
      .send({ from: activeAccount })
      .then(function (receipt: any) {
        console.log(receipt);
      });
  }

When I made a request to transfer 1 USDT, a confirmation window opened in my mobile wallet. But only on the omni wallet I can see 1 USDT amount, in the rainbow wallet it is showing as 1 ETH, and in trustwallet as 0 ETH.

Why is the amount not showing as 1 USDT on Rainbow and trustwallet?

Here is a working example - https://codesandbox.io/s/competent-sky-8lkyq3

Can somebody please tell me, why the USDT amount is not displayed properly and how can I fix this issue?

I have attached screenshots of confirm transfer from the mobile wallets:

Rainbow Wallet screenshot- https://i.stack.imgur.com/HDds4.jpg

Trust Wallet- https://i.stack.imgur.com/jtYhE.jpg

Omni wallet- https://i.stack.imgur.com/pcj7k.jpg

1

There are 1 best solutions below

0
On

Why is the amount not showing as 1 USDT on Rainbow and trustwallet?

Mainly because of two factors

  • There are no quality standards for Ethereum wallets

  • Ethereum does not natively understand about ERC-20 tokens and the ERC-20 token standard is somewhat poorly designed and does not contain UX guidelines how wallets should display token transfers

If this is an issue for you there are two things you can do

  • Advise your users to use a specific wallet you find high quality

  • Build your decentralised application on an alternative blockchain to Ethereum that natively supports assets. Blockchains that natively supports assets and asset transfers include Cosmos based blockchains, Aptos, Sui and other Move-language based blockchains.