encodeKey method
Overrides the base class method to encode a public key as a Neo (NEO) address using Base58 encoding.
Implementation
@override
String encodeKey(List<int> pubKey, {List<int>? versionBytes}) {
final List<int> verBytes = AddrKeyValidator.getAddrArg(
versionBytes,
"versionBytes",
);
/// Validate and get the Nist256p1 public key.
final pubKeyObj = AddrKeyValidator.validateAndGetNist256p1Key(pubKey);
/// Construct the Neo address payload.
final List<int> payloadBytes = [
...NeoAddrConst.prefixByte,
...pubKeyObj.compressed,
...NeoAddrConst.suffixByte,
];
/// Encode the payload as a Base58 address.
return Base58Encoder.checkEncode([
...verBytes,
...QuickCrypto.hash160(payloadBytes),
]);
}