encodeKey method

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

Overrides the method to encode a EOS address from a given public key.

Implementation

@override
String encodeKey(List<int> pubKey) {
  /// Validate and get the Secp256k1 public key object
  final pubKeyObj = AddrKeyValidator.validateAndGetSecp256k1Key(pubKey);

  /// Get the raw compressed public key bytes
  final pubKeyBytes = pubKeyObj.compressed;

  /// Compute the checksum for the address
  final checksumBytes = _EosAddrUtils.computeChecksum(pubKeyBytes);
  final prefix = AddrKeyValidator.getConfigArg(
    CoinsConf.eos.params.addrPrefix,
    "addrPrefix",
  );

  /// Combine the address prefix, public key, and checksum to create the EOS address
  return prefix + Base58Encoder.encode(pubKeyBytes + checksumBytes);
}