isAccountOpen method

Future<bool> isAccountOpen()

Check if an account is open 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> isAccountOpen() async {
  if (!havenoChannel.isConnected) {
    throw DaemonNotConnectedException();
  }
  try {
    var isAccountOpenReply = await havenoChannel.accountClient!.isAccountOpen(IsAccountOpenRequest());
    return isAccountOpenReply.isAccountOpen;
  } on GrpcError catch (e) {
    // Will need to catch whatever exception is thrown for invalid password
    handleGrpcError(e);
    return false;
  }
}