encodeKey method

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

Overrides the address encoding method for Avax P-Chain addresses.

pubKey: The public key to encode into an Avax P-Chain address. kwargs: A map of optional encoding parameters.

This method constructs an Avax P-Chain address by combining the address prefix with the result of encoding the public key using the AtomAddrEncoder with the Human-Readable Part (HRP) from the Avax P-Chain configuration.

Returns the encoded Avax P-Chain address as a String.

Implementation

@override
String encodeKey(List<int> pubKey, [Map<String, dynamic> kwargs = const {}]) {
  String prefix = CoinsConf.avaxPChain.params.addrPrefix!;
  return prefix +
      AtomAddrEncoder().encodeKey(
        pubKey,
        {"hrp": CoinsConf.avaxPChain.params.addrHrp!},
      );
}