kremalicious/blog

View on GitHub
src/features/Web3/lib/truncateAddress/truncateAddress.ts

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
export function truncateAddress(
  address: `0x${string}`,
  startLength = 6,
  endLength = 4
) {
  return `${address.substring(0, startLength)}...${address.substring(
    address.length - endLength
  )}`
}