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, {String? hrp}) {
hrp = AddrKeyValidator.getAddrArg<String>(hrp, "hrp");
final pubKeyObj = AddrKeyValidator.validateAndGetSecp256k1Key(pubKey);
final point = Secp256k1Point.fromBytes(pubKeyObj.toBytes());
final tweakedPubKey = P2TRUtils.tweakPublicKey(point).toXOnly();
return SegwitBech32Encoder.encode(hrp, P2TRConst.witnessVer, tweakedPubKey);
}