shortenAddress

This function shortens an address if it is a valid EVM address.

Note that this function will not check if the address is an ENS.

Example

const address = shortenIfAddress(
"0x1234567890123456789012345678901234567890",
true,
); // result will be "0x1234...890"

Parameters

Returns

The shortened address