DataOption.deserialize constructor
DataOption.deserialize(
- CborObject cbor
Deserializes a DataOption object from its CBOR representation.
Implementation
factory DataOption.deserialize(CborObject cbor) {
if (cbor.hasType<CborBytesValue>()) {
return DataOptionDataHash.deserialize(cbor);
}
final type = TransactionDataOptionType.deserialize(
cbor.cast<CborListValue>().getIndex(0));
if (type == TransactionDataOptionType.dataHash) {
return DataOptionDataHash.deserialize(cbor);
}
return DataOptionData.deserialize(cbor.cast());
}