Skip to content

Address.assert

Asserts that the given value is a valid Address.Address.

Imports

Named
import { Address } from 'ox'

Examples

import { Address } from 'ox'
 
Address.assert('0xA0Cf798816D4b9b9866b5330EEa46a18382f251e')
import { Address } from 'ox'
 
Address.assert('0xdeadbeef')
InvalidAddressError: Address "0xdeadbeef" is invalid.

Definition

function assert(
  value: string,
  options?: assert.Options,
): asserts value is Address

Source: src/Address.ts

Parameters

value

  • Type: string

Value to assert if it is a valid address.

options

  • Type: assert.Options
  • Optional

Assertion options.

options.strict

  • Type: boolean
  • Optional

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

Error Type

Address.assert.ErrorType