decodeAddr method

  1. @override
List<int> decodeAddr(
  1. String addr
)
override

Overrides the base class method to decode an ICON (ICX) address.

Implementation

@override
List<int> decodeAddr(String addr) {
  /// Remove the ICON address prefix.
  final String addrNoPrefix = AddrDecUtils.validateAndRemovePrefix(
    addr,
    AddrKeyValidator.getConfigArg(
      CoinsConf.icon.params.addrPrefix,
      "addrPrefix",
    ),
  );

  /// Convert the remaining string to a `List<int>` and validate its length.
  final List<int> pubKeyHashBytes = BytesUtils.fromHexString(addrNoPrefix);
  AddrDecUtils.validateBytesLength(
    pubKeyHashBytes,
    IcxAddrConst.keyHashByteLen,
  );

  return pubKeyHashBytes;
}