addRecipient method

Transaction addRecipient(
  1. dynamic to
)

Add recipient to the transaction @param {String | Uint8List} to Recipient address (hexadecimal or binary buffer)

Implementation

Transaction addRecipient(dynamic to) {
  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);
  }
  data!.recipients!.add(to);
  return this;
}