encodeKey method
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");
return Bech32Encoder.encode(
hrp, AtomAddressUtils.secp256r1PubKeyToAddress(pubKey));
}