BlockInformation.fromJson constructor

BlockInformation.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory BlockInformation.fromJson(Map<String, dynamic> json) {
  return BlockInformation(
    number: BigInt.parse(json['number']),
    baseFeePerGas: json.containsKey('baseFeePerGas')
        ? EtherAmount.fromBigInt(
            EtherUnit.wei,
            hexToInt(json['baseFeePerGas'] as String),
          )
        : null,
    timestamp: DateTime.fromMillisecondsSinceEpoch(
      hexToDartInt(json['timestamp'] as String) * 1000,
      isUtc: true,
    ),
  );
}