Open 3ph opened 2 years ago
@3ph i have same issue, are you have fixed this issue?
Yes, I have changed the structure of the call which seemed to have fixed it:
final transferFunction = contract.function('transferFrom');
final fee = await _client.estimateGas(
sender: EthereumAddress.fromHex(address),
to: EthereumAddress.fromHex(recipientAddress),
data: transferFunction.encodeCall([
EthereumAddress.fromHex(address),
EthereumAddress.fromHex(recipientAddress),
amount,
]),
);
When checking the ERC721 token, it seems that the correct value cannot be obtained. (The value varies a lot.) Has anyone checked?
Thank you.
I'm trying to estimate the gas fee for the ERC20 token transaction - in this case transferring DAI from one address to another (on Mumbai).
The code for estimating the gas fee:
However, I'm getting
RPCError: got code 3 with msg "execution reverted: Dai/insufficient-allowance"
. The sender address holds enough tokens (approx. 0.0038 Dai). I have tried first to call approve with the same amount but I'm getting a different exceptionRPCError: got code -32000 with msg "already known"
and the gas estimation still fails.Any ideas on how to estimate correctly with web3dart?