Skip to content

Address.validate

Checks if the given address is a valid Address.Address.

Imports

Named
import { Address } from 'ox'

Examples

import { Address } from 'ox'
 
Address.validate('0xA0Cf798816D4b9b9866b5330EEa46a18382f251e')
true
import { Address } from 'ox'
 
Address.validate('0xdeadbeef')
false

Definition

function validate(
  address: string,
  options?: validate.Options,
): address is Address

Source: src/Address.ts

Parameters

address

  • Type: string

Value to check if it is a valid address.

options

  • Type: validate.Options
  • Optional

Check options.

options.strict

  • Type: boolean
  • Optional

Enables strict mode. Whether or not to compare the address against its checksum.

Return Type

Whether the address is a valid address.

address is Address