StakeInstruction.initialize constructor

StakeInstruction.initialize({
  1. required Ed25519HDPublicKey stake,
  2. required Authorized authorized,
  3. Lockup lockup = const Lockup.none(),
})

Initialize a stake with lockup and authorization information.

Implementation

factory StakeInstruction.initialize({
  required Ed25519HDPublicKey stake,
  required Authorized authorized,
  Lockup lockup = const Lockup.none(),
}) =>
    StakeInstruction._(
      accounts: [
        AccountMeta.writeable(pubKey: stake, isSigner: false),
        AccountMeta.readonly(
          pubKey: Ed25519HDPublicKey.fromBase58(Sysvar.rent),
          isSigner: false,
        ),
      ],
      data: ByteArray.merge([
        StakeProgram.initializeInstructionIndex,
        authorized.serialize(),
        lockup.serialize(),
      ]),
    );