output method

void output({
  1. ShelleyAddress? shelleyAddress,
  2. String? address,
  3. MultiAssetBuilder? multiAssetBuilder,
  4. ShelleyValue? value,
  5. bool autoAddMinting = true,
})

build a single ShelleyTransactionOutput, handle complex output construction

Implementation

void output({
  ShelleyAddress? shelleyAddress,
  String? address,
  MultiAssetBuilder? multiAssetBuilder,
  ShelleyValue? value,
  bool autoAddMinting = true,
}) {
  assert(address != null || shelleyAddress != null);
  assert(!(address != null && shelleyAddress != null));
  final String addr =
      shelleyAddress != null ? shelleyAddress.toBech32() : address!;
  assert(multiAssetBuilder != null || value != null);
  assert(!(multiAssetBuilder != null && value != null));
  final val = value ?? multiAssetBuilder!.build();
  final output = ShelleyTransactionOutput(address: addr, value: val);
  _outputs.add(output);
  if (autoAddMinting) {
    _mint.addAll(val.multiAssets);
  }
}