eip1559GasPrice function
Implementation
Future<Map<String, dynamic>> eip1559GasPrice(
Web3Client client,
) async {
final List<dynamic> results = await Future.wait([
client.makeRPCCall<String>("eth_maxPriorityFeePerGas", []),
client.getBlockInformation(),
]);
final fee = results[0];
final block = results[1] as BlockInformation;
final tip = BigInt.parse(fee);
final buffer = tip ~/ BigInt.from(100) * BigInt.from(13);
final maxPriorityFeePerGas = tip + buffer;
final maxFeePerGas = block.baseFeePerGas != null
? (block.baseFeePerGas!.getInWei * BigInt.from(2)) + maxPriorityFeePerGas
: maxPriorityFeePerGas;
return {
'maxFeePerGas': maxFeePerGas,
'maxPriorityFeePerGas': maxPriorityFeePerGas
};
}