mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-05 23:03:06 +00:00
fix: suggestion 1
This commit is contained in:
parent
282b932a8e
commit
fe83a20c4d
@ -179,15 +179,10 @@ impl From<TokenDefinition> for TokedDefinitionAccountView {
|
||||
Self {
|
||||
account_type: "Token definition".to_string(),
|
||||
name: {
|
||||
let mut name_vec_trim = vec![];
|
||||
for ch in value.name {
|
||||
// Assuming, that name does not have UTF-8 NULL and all zeroes are padding.
|
||||
if ch == 0 {
|
||||
break;
|
||||
}
|
||||
name_vec_trim.push(ch);
|
||||
}
|
||||
String::from_utf8(name_vec_trim).unwrap_or(hex::encode(value.name))
|
||||
let name_trimmed: Vec<_> =
|
||||
value.name.into_iter().take_while(|ch| *ch != 0).collect();
|
||||
String::from_utf8(name_trimmed).unwrap_or(hex::encode(value.name))
|
||||
},
|
||||
total_supply: value.total_supply,
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user