encodeKey method

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

This method is used to create an Aptos SingleKey address from ED25519 public key.

Implementation

@override
String encodeKey(List<int> pubKey) {
  final publicKey = AddrKeyValidator.validateAndGetEd25519Key(pubKey);
  final addressBytes = AptosAddressUtils.encodeSingleKey(publicKey);

  /// Concatenate the address prefix and the hash bytes, removing leading zeros
  return BytesUtils.toHexString(
    addressBytes,
    prefix: AddrKeyValidator.getConfigArg(
      CoinsConf.aptos.params.addrPrefix,
      "addrPrefix",
    ),
  );
}