Function: normalizeIotaAddress()
function normalizeIotaAddress(
value,
forceAdd0x?,
validate?): string;
Normalize an IOTA address to ensure consistent format. Perform the following operations:
- Make the address lower case
- Prepend
0xif the string does not start with0x. - Add more zeros if the length of the address(excluding
0x) is less thanIOTA_ADDRESS_LENGTH
WARNING: if the address value itself starts with 0x, e.g., 0x0x, the default behavior
is to treat the first 0x not as part of the address. The default behavior can be overridden by
setting forceAdd0x to true
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
value | string | undefined | The address to normalize |
forceAdd0x | boolean | false | Whether to add 0x prefix without removing any existing 0x prefixes |
validate | boolean | false | Whether to validate the return address |
Returns
string
The normalized address
Throws
Error if flag validate enabled and the address contains invalid hex characters