shortenAddress

Checksums and formats an address if valid. Note this function does not check if the provided address is an ENS.

Example

import { shortenAddress } from "thirdweb/utils";
shortenAddress("0xa0cf798816d4b9b9866b5330eea46a18382f251e");
//=> '0xA0Cf...251e'
function shortenAddress(address: string, length: number): string;

Parameters

The address to shorten.

Type

let address: string;

The number of characters to keep from the start and end of the address.

Type

let length: number;

Returns

let returnType: string;

The shortened address.