encodeKey method

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

Encodes a public key as an Atom (ATOM) cryptocurrency address.

This method takes a public key as input and encodes it as an Atom address using Bech32 encoding with a specific Human-Readable Part (HRP).

The hrp parameter specifies the Human-Readable Part (HRP) used in the Bech32 encoding for Atom addresses.

Returns the Atom address as a string.

Throws an error if the hrp parameter is missing or invalid, or if the public key cannot be validated.

Implementation

@override
String encodeKey(List<int> pubKey, [Map<String, dynamic> kwargs = const {}]) {
  final String hrp =
      AddrKeyValidator.validateAddressArgs<String>(kwargs, "hrp");
  final public = AddrKeyValidator.validateAndGetSecp256k1Key(pubKey);
  return Bech32Encoder.encode(hrp, QuickCrypto.hash160(public.compressed));
}