Address
An object representing a Nimiq address. Offers methods to parse and format addresses from and to strings.
Constructors
new Address()
Parameter | Type |
---|---|
First | Uint8Array |
Returns |
---|
Address |
Methods
__getClassname()
compare()
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.
Parameter | Type |
---|---|
First | Address |
equals()
Returns if this address is equal to the other address.
Parameter | Type |
---|---|
First | Address |
free()
serialize()
Returns the byte representation of the address.
toHex()
Formats the address into hex format.
toPlain()
Formats the address into a plain string format.
toUserFriendlyAddress()
Formats the address into user-friendly IBAN format.
deserialize()
Deserializes an address from a byte array.
Parameter | Type |
---|---|
First | Uint8Array |
Returns |
---|
Address |
fromAny()
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.
Parameter | Type |
---|---|
First | string | Address | Uint8Array |
Returns |
---|
Address |
fromString()
Parses an address from a string representation, either user-friendly or hex format.
Throws when an address cannot be parsed from the string.
Parameter | Type |
---|---|
First | string |
Returns |
---|
Address |
fromUserFriendlyAddress()
Parses an address from its user-friendly string representation.
Throws when an address cannot be parsed from the string.
Parameter | Type |
---|---|
First | string |
Returns |
---|
Address |