getCurrentSystemState method

  1. @override
Future<SystemState> getCurrentSystemState()
override

Implementation

@override
Future<SystemState> getCurrentSystemState() async {
  final data = await _client.executeData(
    _getEpochOperation,
    const GraphQLNoVariables(),
  );
  final epoch = data.epoch;
  final start = epoch?.startTimestamp;
  return SystemState(
    epoch: epoch?.epochId.toString() ?? '0',
    referenceGasPrice: epoch?.referenceGasPrice ?? '0',
    epochStartTimestampMs: start == null
        ? null
        : DateTime.tryParse(start)?.millisecondsSinceEpoch.toString(),
  );
}