decodeAddr method
Overrides the base class method to decode an ICON (ICX) address.
This method decodes an ICON address from the provided input string. It expects an optional map of keyword arguments for custom ICON address parameters. The method performs the following steps:
- Removes the ICON address prefix.
- Validates the length of the decoded public key hash.
- Returns the decoded public key hash as a List
Parameters:
- addr: The ICON address to be decoded as a string.
- kwargs: Optional keyword arguments for custom ICON address parameters (not used in this implementation).
Returns: A List
Implementation
@override
List<int> decodeAddr(String addr, [Map<String, dynamic> kwargs = const {}]) {
/// Remove the ICON address prefix.
String addrNoPrefix = AddrDecUtils.validateAndRemovePrefix(
addr,
CoinsConf.icon.params.addrPrefix!,
);
/// Convert the remaining string to a List<int> and validate its length.
List<int> pubKeyHashBytes = BytesUtils.fromHexString(addrNoPrefix);
AddrDecUtils.validateBytesLength(
pubKeyHashBytes, IcxAddrConst.keyHashByteLen);
return pubKeyHashBytes;
}