Function shortenAddress

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

    Parameters

    • Optional address: string

      The address to shorten

    • Optional extraShort: boolean

      If true, show the first 4 and last 3 characters

    Returns string

    The shortened address

    Remarks

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

    Example

    Calling shortenAddress with extraShort set to true

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

Generated using TypeDoc