encodeKey method

  1. @override
String encodeKey(
  1. List<int> pubKey
)
override

Encodes a public key or address bytes into a blockchain address.

Throws AddressConverterException on invalid input.

Implementation

@override
String encodeKey(List<int> pubKey) {
  final pubKeyObj = AddrKeyValidator.validateAndGetSecp256k1Key(pubKey);
  final keyHash = QuickCrypto.sha256Hash(
    pubKeyObj.toBytes(mode: CryptoKeyEncoding.base),
  );
  return Bech32Encoder.encode(
    AddrKeyValidator.getConfigArg(
      CoinsConf.zilliqa.params.addrHrp,
      "addrHrp",
    ),
    keyHash.sublist(keyHash.length - ZilAddrConst.sha256ByteLen),
  );
}