fix: do not print size and name when meta is unknown (#297)

* fix: do not print zero when size is unknown

* fix: do not print name if it is the same as the hash

* feat: shorten asset name
This commit is contained in:
Cafe137
2022-01-27 16:22:27 +01:00
committed by GitHub
parent f4013142af
commit 7880c802ae
2 changed files with 16 additions and 5 deletions
+8
View File
@@ -192,3 +192,11 @@ export function calculateStampPrice(depth: number, amount: number, currentPrice:
return (amount * 2 ** (depth - 16) * price) / 1e16
}
export function shortenText(text: string, length = 20, separator = '[…]'): string {
if (text.length <= length * 2 + separator.length) {
return text
}
return `${text.slice(0, length)}${separator}${text.slice(-length)}`
}