-1

I am getting an invalid amount error while connecting to my dapp using the metamask mobile appilication. It works fine with the browser plugin but not on the mobile app. I am trying to transfer BUSD using etherJs. I already connected with the BUSD contract and abi, and like I mentioned it works fine on web but shows "invalid amount" on mobile app. I'd really appreciate the help.

Here's what my code looks like

             const price_r = ethers.utils.parseUnits(price_, 18);
              const {BUSDContract, signer} = await getContract();  
              const contract = BUSDContract.connect(signer)
              m_response = await contract.transfer(
                '0xf0e2fb4174A66dbD5A4B94B9D6331eA05460542d',
                `${amount}`,
                {
                  gasLimit: 3000000,
                }
              );

This works quite when with the metamask browser plugin. However, when I switch to the metamask mobile app it shows the invalid amount as shown below.

Metamask mobile invalid error image

flair
  • 1
  • 3
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community May 07 '22 at 05:24

2 Answers2

0

Add gasLimit and gasPrice:

const gasLimit = await Contract.estimateGas.transfer(to, amount, {from: account });
const gasPrice = await library.getGasPrice();
    
const tx = await Contract.transfer(to, amount, {
  from: account,
  gasLimit: gasLimit,
  gasPrice: gasPrice
});
const response = await tx.wait();
return response;
Mad
  • 71
  • 1
  • 8
  • This is similar to what I currently have. However, this doesn't seem to work. Still have the invalid amount showing – flair May 08 '22 at 12:47
0

Just in case anyone comes into this issue, I was able to resolve it by switching from etherjs to web3.

flair
  • 1
  • 3
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 14 '22 at 01:40