createXmrTx method

Future<XmrTx?> createXmrTx(
  1. Iterable<XmrDestination> destinations
)

Creates a new XMR transaction for the specified destinations.

This method sends a CreateXmrTxRequest with a list of XmrDestination objects representing the recipients of the transaction.

Example:

final tx = await walletsService.createXmrTx([destination1, destination2]);
print('Transaction ID: ${tx?.txId}');

Returns:

  • A Future containing the created XmrTx.
  • null if an error occurs.

Implementation

Future<XmrTx?> createXmrTx(Iterable<XmrDestination> destinations) async {
  if (!havenoChannel.isConnected) {
    throw DaemonNotConnectedException();
  }
  try {
    final createXmrTxsReply = await havenoChannel.walletsClient!
        .createXmrTx(CreateXmrTxRequest(destinations: destinations));
    return createXmrTxsReply.tx;
  } on GrpcError catch (e) {
    handleGrpcError(e);
    return null;
  }
}