toCbor method

  1. @override
CborObject toCbor()
override

Converts the object to a CBOR object.

Implementation

@override
CborObject toCbor() {
  final tag = PlutusDataUtils.alternativeToCborTag(alternative);
  if (tag != null) {
    return CborTagValue(data.toCbor(), [tag]);
  }
  return CborTagValue(
      CborListValue.fixedLength(
          [CborUnsignedValue.u64(alternative), data.toCbor()]),
      [PlutusDataUtils.generalFormTag]);
}