accountExists method

Future<bool> accountExists()

Getter to retrieve the account existence flag.

Returns true if the account exists, false if it does not exist, or null if the existence check has not been performed. Checks if an account exists on the Haveno server.

Throws a DaemonNotConnectedException if the havenoChannel is not connected.

Returns true if the account exists, false otherwise.

Throws specific exceptions depending on the gRPC error encountered.

Implementation

//bool? get accountExists => _accountExists;

/// Checks if an account exists on the Haveno server.
///
/// Throws a [DaemonNotConnectedException] if the [havenoChannel] is not connected.
///
/// Returns `true` if the account exists, `false` otherwise.
///
/// Throws specific exceptions depending on the gRPC error encountered.
Future<bool> accountExists() async {
  if (!havenoChannel.isConnected) {
    throw DaemonNotConnectedException();
  }
  try {
    final accountExistsReply = await havenoChannel.accountClient!.accountExists(AccountExistsRequest());
    return accountExistsReply.accountExists;
  } on GrpcError catch (e) {
    handleGrpcError(e);
    return false;
  }
}