fetchSysvarLastRestartSlot function

Future<SysvarLastRestartSlot> fetchSysvarLastRestartSlot(
  1. Rpc rpc, {
  2. FetchAccountConfig? config,
})

Fetches the LastRestartSlot sysvar account using the provided RPC client.

Implementation

Future<SysvarLastRestartSlot> fetchSysvarLastRestartSlot(
  Rpc rpc, {
  FetchAccountConfig? config,
}) async {
  final account = await fetchEncodedSysvarAccount(
    rpc,
    sysvarLastRestartSlotAddress,
    config: config,
  );
  assertAccountExists(account);
  final decoded = decodeAccount(
    (account as ExistingAccount<Uint8List>).account,
    getSysvarLastRestartSlotDecoder(),
  );
  return decoded.data;
}