getXmrPrimaryAddress method

Future<String?> getXmrPrimaryAddress()

Retrieves the primary XMR address of the wallet.

This method sends a GetXmrPrimaryAddressRequest to retrieve the primary XMR address of the wallet.

Example:

final address = await walletsService.getXmrPrimaryAddress();
print('Primary XMR Address: $address');

Returns:

  • A Future containing the primary address as a String.
  • null if an error occurs.

Implementation

Future<String?> getXmrPrimaryAddress() async {
  if (!havenoChannel.isConnected) {
    throw DaemonNotConnectedException();
  }
  try {
    final getXmrPrimaryAddressReply = await havenoChannel.walletsClient!
        .getXmrPrimaryAddress(GetXmrPrimaryAddressRequest());
    return getXmrPrimaryAddressReply.primaryAddress;
  } on GrpcError catch (e) {
    handleGrpcError(e);
  }
  return null;
}