ethEstimateGas static method

Future<String> ethEstimateGas(
  1. String from,
  2. String? to,
  3. String value,
  4. String data,
)

call eth_estimateGas, get gasLimit

from is sender public address.

to if send native token, is recevier address, if send erc20 token or nft, is contract address.

value is native token amount in hex string.

data transacion data

Implementation

static Future<String> ethEstimateGas(
    String from, String? to, String value, String data) async {
  const method = "eth_estimateGas";
  final params = [
    {"from": from, "to": to, "data": data, "value": value}
  ];
  return await EvmService.rpc(method, params);
}