addUCOTransfer method

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

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

Implementation

Transaction addUCOTransfer(dynamic to, int amount) {
  if (to is! Uint8List && to is! String) {
    throw "'to' must be a string or Uint8List";
  }

  if (to is String) {
    if (!isHex(to)) {
      throw "'to' must be an hexadecimal string";
    }
  } else {
    to = uint8ListToHex(to);
  }
  final UCOTransfer ucoTransfer = UCOTransfer(to: to, amount: amount);
  data!.ledger!.uco!.transfers!.add(ucoTransfer);
  return this;
}