FeeHistory.fromJson constructor
Constructs a FeeHistory object from JSON.
Implementation
factory FeeHistory.fromJson(Map<String, dynamic> json) {
final List<BigInt> baseFeePerGas = (json['baseFeePerGas'] as List?)
?.map((fee) => PluginBigintUtils.hexToBigint(fee))
.toList() ??
<BigInt>[];
final List<double> gasUsedRatio = (json['gasUsedRatio'] as List<dynamic>)
.map<double>((e) => PluginIntUtils.toDouble(e))
.toList();
final List<List<BigInt>> reward = (json['reward'] as List).map((r) {
return (r as List)
.map((value) => PluginBigintUtils.hexToBigint(value))
.toList();
}).toList();
return FeeHistory(
baseFeePerGas: baseFeePerGas,
gasUsedRatio: gasUsedRatio,
oldestBlock: PluginIntUtils.hexToInt(json['oldestBlock']),
reward: reward,
);
}