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:
@@ -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)}`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user