addRecipient method

Transaction addRecipient(
  1. String to, {
  2. String? action,
  3. List<Object>? args,
})

Add recipient to the transaction (with a named action) @param {String} to Recipient address (hexadecimal) @param {string} action The named action @param {List

Implementation

Transaction addRecipient(
  String to, {
  String? action,
  List<Object>? args,
}) {
  if (!isHex(to)) {
    throw const FormatException("'to' must be an hexadecimal string");
  }

  final newRecipient = data!.actionRecipients.toList()
    ..add(Recipient(address: to, action: action, args: args));
  return copyWith.data!(
    actionRecipients: newRecipient,
  );
}