getGasPrice method

  1. @override
Future<Map<String, EtherAmount>> getGasPrice()
override

Returns the gas price in wei for a network.

Returns a Future that completes with a Map containing the following keys:

  • 'maxFeePerGas': An EtherAmount representing the maximum fee per gas.
  • 'maxPriorityFeePerGas': An EtherAmount representing the maximum priority fee per gas.

Implementation

@override
Future<Map<String, EtherAmount>> getGasPrice() async {
  try {
    return await getEip1559GasPrice();
  } catch (e) {
    final value = await getLegacyGasPrice();
    return {
      'maxFeePerGas': value,
      'maxPriorityFeePerGas': value,
    };
  }
}