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.addressKeyValidationFailed(
      reason: "Invalid ${EllipticCurveTypes.secp256k1.name} public key.",
    );
  }
}