encodeSecp256k1 static method

List<int> encodeSecp256k1(
  1. List<int> bytes
)

encode secp256k1 public key to address

Implementation

static List<int> encodeSecp256k1(List<int> bytes) {
  try {
    final key = AddrKeyValidator.validateAndGetSecp256k1Key(bytes).compressed;
    return hashKeyBytes(
        bytes: key, scheme: SuiAddrConst.secp256k1AddressFlag);
  } catch (e) {
    throw AddressConverterException(
        "Failed to generate sui address: Invalid secp256k1 public key provided.");
  }
}