encodeKey method

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

Overrides the base class method to encode a public key as an INJ (Injective Protocol) address.

This method encodes a public key as an INJ address. It expects the public key as a List

  1. Encoding the public key as an Ethereum (ETH) address using EthAddrEncoder.
  2. Encoding the ETH address using the INJ address human-readable part (hrp).

Parameters:

  • pubKey: The public key to be encoded as an INJ address in the form of a List
  • kwargs: Optional keyword arguments (not used in this implementation).

Returns: A string representing the INJ address corresponding to the provided public key.

Implementation

@override
String encodeKey(List<int> pubKey, [Map<String, dynamic> kwargs = const {}]) {
  /// Encode the public key as an Ethereum (ETH) address.
  final ethAddr = EthAddrEncoder().encodeKey(pubKey);

  /// Encode the ETH address using the INJ address human-readable part (hrp).
  return Bech32Encoder.encode(
      CoinsConf.injective.params.addrHrp!, BytesUtils.fromHexString(ethAddr));
}