Address.from
Converts a stringified address to a typed (checksummed) Address.Address
.
Imports
Named
import { Address } from 'ox'
Examples
import { Address } from 'ox'
Address.from('0xa0cf798816d4b9b9866b5330eea46a18382f251e')
'0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'
import { Address } from 'ox'
Address.from('0xa0cf798816d4b9b9866b5330eea46a18382f251e', {
checksum: false
})
'0xa0cf798816d4b9b9866b5330eea46a18382f251e'
import { Address } from 'ox'
Address.from('hello')
InvalidAddressError: Address "0xa" is invalid.
Definition
function from(
address: string,
options?: from.Options,
): Address
Source: src/Address.ts
Parameters
address
- Type:
string
An address string to convert to a typed Address.
options
- Type:
from.Options
- Optional
Conversion options.
options.checksum
- Type:
boolean
- Optional
Whether to checksum the address.
Return Type
The typed Address.
Address
Error Type
Address.from.ErrorType