addUCOTransfer method

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

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

Implementation

Transaction addUCOTransfer(to, double 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);
  this.data!.ledger!.uco!.transfers!.add(ucoTransfer);
  return this;
}