getCurrentSystemState method
Implementation
@override
Future<SystemState> getCurrentSystemState() async {
final response = await _client.ledgerService.getEpoch(
GetEpochRequest(
readMask: FieldMask(
paths: [
'epoch',
'reference_gas_price',
'start',
'system_state.version',
'system_state.epoch',
'system_state.protocol_version',
'system_state.reference_gas_price',
'system_state.epoch_start_timestamp_ms',
'system_state.safe_mode',
'system_state.safe_mode_storage_rewards',
'system_state.safe_mode_computation_rewards',
'system_state.safe_mode_storage_rebates',
'system_state.safe_mode_non_refundable_storage_fee',
'system_state.parameters',
'system_state.storage_fund',
'system_state.stake_subsidy',
],
),
),
);
final epoch = response.epoch;
return SystemState(
epoch: epoch.epoch.toStringUnsigned(),
referenceGasPrice: epoch.referenceGasPrice.toStringUnsigned(),
systemState: epoch.hasSystemState()
? epoch.systemState.toProto3Json() as Map<String, dynamic>
: null,
epochStartTimestampMs: epoch.hasStart()
? (epoch.start.seconds * Int64(1000) +
Int64(epoch.start.nanos ~/ 1000000))
.toString()
: null,
);
}