encodeKey method

  1. @override
String encodeKey(
  1. List<int> pubKey, [
  2. Map<String, dynamic> kwargs = const {}
])
override

Overrides the method to encode an Egld (Elrond) address based on the provided pubKey.

pubKey: The List

This method encodes the Egld address by using the specified Human-Readable Part (HRP) and converting the raw compressed public key to bytes.

Returns the string representation of the encoded Egld address.

Implementation

@override
String encodeKey(List<int> pubKey, [Map<String, dynamic> kwargs = const {}]) {
  /// Validate and retrieve the Ed25519 public key
  final pubKeyObj = AddrKeyValidator.validateAndGetEd25519Key(pubKey);

  /// Encode the Egld address using the provided HRP and the raw compressed public key
  return Bech32Encoder.encode(
    CoinsConf.elrond.params.addrHrp!,
    pubKeyObj.compressed.sublist(1),
  );
}