isAppInitialized method

Future<bool> isAppInitialized()

Check an the account is initialized on the daemon

Throws a DaemonNotConnectedException if the havenoChannel is not connected.

Returns true if the daemon is initialized with an account, false otherwise.

Throws specific exceptions depending on the gRPC error encountered.

Implementation

Future<bool> isAppInitialized() async {
  if (!havenoChannel.isConnected) {
    throw DaemonNotConnectedException();
  }
  try {
    // Need to check what this is actually returning #TODO
    var isAppInitializedReply = await havenoChannel.accountClient!.isAppInitialized(IsAppInitializedRequest());
    return isAppInitializedReply.isAppInitialized;
  } on GrpcError catch (e) {
    // Will need to catch whatever exception is thrown for invalid password
    handleGrpcError(e);
    return false;
  }
}