Hi, I would like to do a 'estimateGas' but I want to send it as a JSON-Rpc and not use the ethers method.
But it fails unfortunately.
So, if I do it through ethers it works:
final Web3Provider mmProv = Web3Provider(ethereum);
final BigInt gas = await mmProv.call<BigInt>(
'estimateGas',
[
TransactionRequest(
from: accountAddress,
to: smartContractAddress,
data: payload,
)
],
);
But Ethers throws another error about "UNPREDICTABLE_GAS_LIMIT" so I'm trying to avoid using it with a request like this:
final gas = await ethereum!.request(
"eth_estimateGas",
[
TransactionRequest(
from: accountAddress,
to: smartContractAddress,
data: payload,
),
"latest",
],
);
but it always returns 53'000 GAS which is not correct.
Doing it like this returns also the same result:
final gas2 = await ethereum!.request(
"eth_estimateGas",
[
{
"from": accountAddress,
"to": smartContractAddress,
"data": hexPayload,
},
"latest",
],
);
Trying the last one in pure JS works so I must be missing something on the Dart side.
Can anyone tell me what I'm doing wrong?
Hi, I would like to do a 'estimateGas' but I want to send it as a JSON-Rpc and not use the ethers method.
But it fails unfortunately.
So, if I do it through ethers it works:
But Ethers throws another error about "UNPREDICTABLE_GAS_LIMIT" so I'm trying to avoid using it with a request like this:
but it always returns 53'000 GAS which is not correct.
Doing it like this returns also the same result:
Trying the last one in pure JS works so I must be missing something on the Dart side.
Can anyone tell me what I'm doing wrong?