在使用元am移动应用连接到我的dapp时,我得到了一个无效的金额错误。它在浏览器插件上运行得很好,但在移动应用程序上就不行了。我正在尝试使用etherJs来转移BUSD。我已经与but合同和abi建立了联系,就像我提到的,它在网络上运行良好,但在移动应用程序上显示“无效数量”。我真的很感谢你的帮助。
下面是我的代码
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,
}
);当使用元the浏览器插件时,这是非常有效的。然而,当我切换到元as移动应用程序时,它会显示无效的数量,如下所示。
发布于 2022-05-07 17:57:48
添加gasLimit和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;发布于 2022-05-09 13:04:49
万一有人出现这个问题,我可以通过从etherjs切换到web3来解决。
https://stackoverflow.com/questions/72141251
复制相似问题