parseBytes static method
Parses a value into a byte list from a hex string or List<int
>.
Implementation
static List<int> parseBytes({Object? value}) {
try {
if (value is String) {
final bytes = BytesUtils.tryFromHexString(value);
if (bytes != null) return bytes.asImmutableBytes;
} else if (value is List) {
return value.cast<int>().asImmutableBytes;
}
} catch (_) {}
throw BcsSerializationException(
"Invalid value for move type 'Bytes': Expected a List<int> or a hexadecimal string.",
details: {"value": "$value"});
}