encodeKey method

  1. @override
String encodeKey(
  1. List<int> pubKey, {
  2. List<int>? netVersion,
  3. Base58Alphabets alphabet = Base58Alphabets.bitcoin,
  4. PubKeyModes pubKeyMode = PubKeyModes.compressed,
})
override

Overrides the base class method to encode a public key as a P2PKH (Pay-to-Public-Key-Hash) address.

Implementation

@override
String encodeKey(
  List<int> pubKey, {
  List<int>? netVersion,
  Base58Alphabets alphabet = Base58Alphabets.bitcoin,
  PubKeyModes pubKeyMode = PubKeyModes.compressed,
}) {
  final List<int> netVerBytes = AddrKeyValidator.getAddrArg(
    netVersion,
    "netVersion",
  );
  return Base58Encoder.checkEncode([
    ...netVerBytes,
    ...validateAndHashKey(pubKey, pubKeyMode: pubKeyMode),
  ], alphabet);
}