Display short addresses differently

Use an "en dash" instead of an ellipsis.

Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
Alexis Sellier
2021-09-16 14:31:54 +02:00
parent 6fcac9cffe
commit 3a5ee3f3d6
3 changed files with 10 additions and 6 deletions
+6 -2
View File
@@ -48,8 +48,12 @@ export function formatCAIP10Address(address: string, protocol: string, impl: num
return `${address.toLowerCase()}@${protocol}:${impl.toString()}`;
}
export function formatAddress(addr: string): string {
return formatHash(ethers.utils.getAddress(addr)).replace(/^0x/, "");
export function formatAddress(input: string): string {
const addr = ethers.utils.getAddress(input).replace(/^0x/, "");
return addr.substring(0, 4)
+ ' – '
+ addr.substring(addr.length - 4, addr.length);
}
export function formatIpfsFile(ipfs: string | undefined): string | undefined {