Skip to content
On this page

getAddress โ€‹

Converts an address into an address that is checksum encoded. Supports EIP-1191.

Import โ€‹

ts
import { getAddress } from 'viem'

Usage โ€‹

ts
import { getAddress } from 'viem'

getAddress('0xa5cc3c03994db5b0d9a5eEdD10Cabab0813678ac') 
// '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC'

// EIP-1191 address
getAddress('0x27b1fdb04752bbc536007a920d24acb045561c26', 30)
// '0x27b1FdB04752BBc536007A920D24ACB045561c26'

Returns โ€‹

Address

The checksummed address.

Parameters โ€‹

address โ€‹

  • Type: string

An Ethereum address.

chainId (optional) โ€‹

  • Type: number

The chain ID of the network the address is on. Complies to EIP-1191.

Released under the MIT License.