StakeInstruction.authorizeCheckedWithSeed constructor

StakeInstruction.authorizeCheckedWithSeed({
  1. required Ed25519HDPublicKey stake,
  2. required Ed25519HDPublicKey base,
  3. required AuthorizeWithSeedArgs authorizeWithSeedArgs,
  4. Ed25519HDPublicKey? lockupAuthority,
})

Authorize a key to manage stake or withdrawal with a derived key.

This instruction behaves like AuthorizeWithSeed with the additional requirement that the new stake or withdraw authority must also be a signer.

Implementation

factory StakeInstruction.authorizeCheckedWithSeed({
  required Ed25519HDPublicKey stake,
  required Ed25519HDPublicKey base,
  required AuthorizeWithSeedArgs authorizeWithSeedArgs,
  Ed25519HDPublicKey? lockupAuthority,
}) =>
    StakeInstruction._(
      accounts: [
        AccountMeta.writeable(pubKey: stake, isSigner: false),
        AccountMeta.readonly(pubKey: base, isSigner: true),
        AccountMeta.readonly(
          pubKey: Ed25519HDPublicKey.fromBase58(Sysvar.clock),
          isSigner: false,
        ),
        AccountMeta.readonly(
          pubKey: authorizeWithSeedArgs.stakeAuthorize.pubKey,
          isSigner: true,
        ),
        if (lockupAuthority != null)
          AccountMeta.readonly(pubKey: lockupAuthority, isSigner: true),
      ],
      data: ByteArray.merge([
        StakeProgram.authorizeCheckedInstructionIndex,
        authorizeWithSeedArgs.serialize(),
      ]),
    );