Skip to content

Class: Address

Defined in: @nimiq/core/types/wasm/web.d.ts:615

An object representing a Nimiq address. Offers methods to parse and format addresses from and to strings.

Constructors

new Address()

new Address(bytes): Address

Defined in: @nimiq/core/types/wasm/web.d.ts:618

Parameters

bytes

Uint8Array

Returns

Address

Methods

__getClassname()

__getClassname(): string

Defined in: @nimiq/core/types/wasm/web.d.ts:617

Returns

string


compare()

compare(other): number

Defined in: @nimiq/core/types/wasm/web.d.ts:667

Compares this address to the other address.

Returns -1 if this address is smaller than the other address, 0 if they are equal, and 1 if this address is larger than the other address.

Parameters

other

Address

Returns

number


equals()

equals(other): boolean

Defined in: @nimiq/core/types/wasm/web.d.ts:660

Returns if this address is equal to the other address.

Parameters

other

Address

Returns

boolean


free()

free(): void

Defined in: @nimiq/core/types/wasm/web.d.ts:616

Returns

void


serialize()

serialize(): Uint8Array

Defined in: @nimiq/core/types/wasm/web.d.ts:656

Returns the byte representation of the address.

Returns

Uint8Array


toHex()

toHex(): string

Defined in: @nimiq/core/types/wasm/web.d.ts:652

Formats the address into hex format.

Returns

string


toPlain()

toPlain(): string

Defined in: @nimiq/core/types/wasm/web.d.ts:644

Formats the address into a plain string format.

Returns

string


toUserFriendlyAddress()

toUserFriendlyAddress(): string

Defined in: @nimiq/core/types/wasm/web.d.ts:648

Formats the address into user-friendly IBAN format.

Returns

string


deserialize()

static deserialize(bytes): Address

Defined in: @nimiq/core/types/wasm/web.d.ts:622

Deserializes an address from a byte array.

Parameters

bytes

Uint8Array

Returns

Address


fromAny()

static fromAny(addr): Address

Defined in: @nimiq/core/types/wasm/web.d.ts:628

Parses an address from an Address instance, a hex string representation, or a byte array.

Throws when an address cannot be parsed from the argument.

Parameters

addr

string | Uint8Array | Address

Returns

Address


fromString()

static fromString(str): Address

Defined in: @nimiq/core/types/wasm/web.d.ts:634

Parses an address from a string representation, either user-friendly or hex format.

Throws when an address cannot be parsed from the string.

Parameters

str

string

Returns

Address


fromUserFriendlyAddress()

static fromUserFriendlyAddress(str): Address

Defined in: @nimiq/core/types/wasm/web.d.ts:640

Parses an address from its user-friendly string representation.

Throws when an address cannot be parsed from the string.

Parameters

str

string

Returns

Address