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