StakeInstruction.authorizeWithSeed constructor

StakeInstruction.authorizeWithSeed({
  1. required Ed25519HDPublicKey stake,
  2. required Ed25519HDPublicKey authorityBase,
  3. required AuthorizeWithSeedArgs args,
  4. Ed25519HDPublicKey? lockupAuthority,
})

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

Implementation

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