decodeAddr method

  1. @override
List<int> decodeAddr(
  1. String addr, [
  2. Map<String, dynamic> kwargs = const {}
])
override

Overrides the base class method to decode a Near Protocol address.

This method decodes a Near Protocol address from the provided input string, which is expected to be a hexadecimal representation of the public key bytes. It validates the length of the input, ensuring it matches the expected compressed Ed25519 public key length. The decoded public key bytes are returned as a List

Parameters:

  • addr: The hexadecimal representation of the public key bytes for the Near Protocol address.
  • kwargs: Optional keyword arguments (not used in this implementation).

Returns: A List

Implementation

@override
List<int> decodeAddr(String addr, [Map<String, dynamic> kwargs = const {}]) {
  /// Convert the hexadecimal input to bytes.
  List<int> pubKeyBytes = BytesUtils.fromHexString(addr);

  /// Validate the length of the public key bytes.
  AddrDecUtils.validateBytesLength(
      pubKeyBytes, Ed25519KeysConst.pubKeyByteLen);

  return pubKeyBytes;
}