EvmNetworkFees.fromJson constructor
EvmNetworkFees.fromJson( - Map<String, dynamic> json
)
Implementation
factory EvmNetworkFees.fromJson(Map<String, dynamic> json) {
if (json
case {
'suggestBaseFee': String last,
'SafeGasPrice': String safe,
'ProposeGasPrice': String propose,
'FastGasPrice': String fast,
}) {
final safe_num = toGwei(safe);
final propose_num = toGwei(propose);
final fast_num = toGwei(fast);
final last_num = toGwei(last);
final safePriority = safe_num - last_num;
final averagePriority = propose_num - last_num;
final fastPriority = fast_num - last_num;
return EvmNetworkFees(
lastBlock: last_num,
safe: safe_num,
average: propose_num,
fast: fast_num,
safePriority: safePriority,
averagePriority: averagePriority,
fastPriority: fastPriority,
);
}
if (json
case {
'SafeGasPrice': String safe,
'ProposeGasPrice': String average,
'FastGasPrice': String fast,
}) {
final safe_num = toGwei(safe);
final last_num = safe_num;
final average_num = toGwei(average);
final fast_num = toGwei(fast);
return EvmNetworkFees(
lastBlock: last_num,
safe: safe_num,
average: average_num,
fast: fast_num,
safePriority: BigInt.zero,
averagePriority: BigInt.zero,
fastPriority: BigInt.zero,
);
}
throw UnimplementedError();
}