DRep.deserialize constructor

DRep.deserialize(
  1. CborListValue<CborObject> cbor
)

Implementation

factory DRep.deserialize(CborListValue cbor) {
  final type = DRepType.deserialize(cbor.elementAt<CborIntValue>(0));
  return switch (type) {
    DRepType.drepKeyHash => DRepKeyHash.deserialize(cbor),
    DRepType.drepScriptHash => DRepScriptHash.deserialize(cbor),
    DRepType.alwaysAbstain => AlwaysAbstain.deserialize(cbor),
    DRepType.alwaysNoConfidence => AlwaysNoConfidence.deserialize(cbor),
    _ => throw UnimplementedError("Invalid drep type.")
  };
}