RelayType.deserialize constructor

RelayType.deserialize(
  1. CborIntValue cbor, {
  2. RelayType? validate,
})

Deserialize a RelayType from a CBOR integer value.

Implementation

factory RelayType.deserialize(CborIntValue cbor, {RelayType? validate}) {
  final type = fromValue(cbor.value);
  if (validate != null && type != validate) {
    throw MessageException("Invalid RelayType.",
        details: {"Expected": validate, "Type": type});
  }
  return fromValue(cbor.value);
}