Ed25519ProgramLayout.fromPrivateKey constructor

Ed25519ProgramLayout.fromPrivateKey({
  1. required SolanaPrivateKey privateKey,
  2. required List<int> message,
  3. int? instructionIndex,
})

Create an ed25519 instruction with a private key.

Implementation

factory Ed25519ProgramLayout.fromPrivateKey({
  required SolanaPrivateKey privateKey,
  required List<int> message,
  int? instructionIndex,
}) {
  final pubkey = privateKey.publicKey();
  final signature = privateKey.sign(message);
  return Ed25519ProgramLayout.fromPublicKey(
    publicKey: pubkey,
    message: message,
    signature: signature,
    instructionIndex: instructionIndex,
  );
}