encodeKey method
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
- Encoding the public key as an Ethereum (ETH) address using EthAddrEncoder.
- 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));
}