StakeInstruction.delegateStake constructor

StakeInstruction.delegateStake({
  1. required Ed25519HDPublicKey stake,
  2. required Ed25519HDPublicKey vote,
  3. required Ed25519HDPublicKey config,
  4. required Ed25519HDPublicKey authority,
})

Delegate a stake to a particular vote account.

Implementation

factory StakeInstruction.delegateStake({
  required Ed25519HDPublicKey stake,
  required Ed25519HDPublicKey vote,
  required Ed25519HDPublicKey config,
  required Ed25519HDPublicKey authority,
}) =>
    StakeInstruction._(
      accounts: [
        AccountMeta.writeable(pubKey: stake, isSigner: false),
        AccountMeta.readonly(pubKey: vote, isSigner: false),
        AccountMeta.readonly(
          pubKey: Ed25519HDPublicKey.fromBase58(Sysvar.clock),
          isSigner: false,
        ),
        AccountMeta.readonly(
          pubKey: Ed25519HDPublicKey.fromBase58(Sysvar.stakeHistory),
          isSigner: false,
        ),
        AccountMeta.readonly(pubKey: config, isSigner: false),
        AccountMeta.readonly(pubKey: authority, isSigner: true),
      ],
      data: StakeProgram.delegateStakeInstructionIndex,
    );