addUCOTransfer method

Transaction addUCOTransfer(
  1. String to,
  2. int amount
)

Add a UCO transfer to the transaction @param {String} to Address of the recipient (hexadecimal) @param {int} amount Amount of UCO to transfer

Implementation

Transaction addUCOTransfer(String to, int amount) {
  if (!isHex(to)) {
    throw const FormatException("'to' must be an hexadecimal string");
  }

  final newUCOTransfer = data!.ledger!.uco!.transfers
    ..add(UCOTransfer(to: to, amount: amount));
  return copyWith.data!.ledger!.uco!(
    transfers: newUCOTransfer,
  );
}