StakeInstruction.setLockup constructor

StakeInstruction.setLockup({
  1. required Ed25519HDPublicKey stake,
  2. required Ed25519HDPublicKey authority,
  3. required Lockup lockup,
})

Set stake lockup.

If a lockup is not active, the withdraw authority may set a new lockup. If a lockup is active, the lockup custodian may update the lockup parameters.

Implementation

factory StakeInstruction.setLockup({
  required Ed25519HDPublicKey stake,
  required Ed25519HDPublicKey authority,
  required Lockup lockup,
}) =>
    StakeInstruction._(
      accounts: [
        AccountMeta.writeable(pubKey: stake, isSigner: false),
        AccountMeta.readonly(pubKey: authority, isSigner: true),
      ],
      data: ByteArray.merge([
        StakeProgram.setLockupInstructionIndex,
        lockup.serialize(),
      ]),
    );