Show strings as UTF-8 text string during type reification
Instead of defaulting to hex-encoded bytearrays.
This commit is contained in:
parent
9cf908d07f
commit
799546b654
|
@ -1063,11 +1063,20 @@ impl UntypedExpr {
|
||||||
value: from_pallas_bigint(i).to_string(),
|
value: from_pallas_bigint(i).to_string(),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
PlutusData::BoundedBytes(bytes) => Ok(UntypedExpr::ByteArray {
|
PlutusData::BoundedBytes(bytes) => {
|
||||||
location: Span::empty(),
|
if tipo.is_string() {
|
||||||
bytes: bytes.into(),
|
Ok(UntypedExpr::String {
|
||||||
preferred_format: ByteArrayFormatPreference::HexadecimalString,
|
location: Span::empty(),
|
||||||
}),
|
value: String::from_utf8(bytes.to_vec()).expect("invalid UTF-8 string"),
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
Ok(UntypedExpr::ByteArray {
|
||||||
|
location: Span::empty(),
|
||||||
|
bytes: bytes.into(),
|
||||||
|
preferred_format: ByteArrayFormatPreference::HexadecimalString,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PlutusData::Array(args) => match tipo {
|
PlutusData::Array(args) => match tipo {
|
||||||
Type::App {
|
Type::App {
|
||||||
|
|
Loading…
Reference in New Issue