encodeKey method
Encodes a public key or address bytes into a blockchain address.
Throws AddressConverterException on invalid input.
Implementation
@override
String encodeKey(List<int> pubKey, {List<int>? netVersion, String? hrp}) {
hrp = AddrKeyValidator.getAddrArg<String>(hrp, "hrp");
netVersion = AddrKeyValidator.getAddrArg<List<int>>(
netVersion,
"netVersion",
);
final pubKeyObj = AddrKeyValidator.validateAndGetSecp256k1Key(pubKey);
final pubkeyHash = QuickCrypto.hash160(
pubKeyObj.toBytes(mode: CryptoKeyEncoding.base),
);
return BchBech32Encoder.encode(hrp, netVersion, pubkeyHash);
}