DRep.fromJson constructor

DRep.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory DRep.fromJson(Map<String, dynamic> json) {
  final type = DRepType.fromJson(json);
  return switch (type) {
    DRepType.drepKeyHash => DRepKeyHash.fromJson(json),
    DRepType.drepScriptHash => DRepScriptHash.fromJson(json),
    DRepType.alwaysAbstain => AlwaysAbstain.fromJson(json),
    DRepType.alwaysNoConfidence => AlwaysNoConfidence.fromJson(json),
    _ => throw UnimplementedError("Invalid drep type.")
  };
}