StakeProgram.delegate constructor

StakeProgram.delegate({
  1. required SolAddress stakePubkey,
  2. required SolAddress authorizedPubkey,
  3. required SolAddress votePubkey,
})

Generate a Transaction that delegates Stake tokens to a validator Vote PublicKey. This transaction can also be used to redelegate Stake to a new validator Vote PublicKey.

Implementation

factory StakeProgram.delegate(
    {required SolAddress stakePubkey,
    required SolAddress authorizedPubkey,
    required SolAddress votePubkey}) {
  return StakeProgram(
      layout: const StakeDelegateLayout(),
      keys: [
        stakePubkey.toWritable(),
        votePubkey.toReadOnly(),
        SystemProgramConst.sysvarClockPubkey.toReadOnly(),
        SystemProgramConst.sysvarStakeHistoryPubkey.toReadOnly(),
        StakeProgramConst.stakeConfigId.toReadOnly(),
        authorizedPubkey.toSigner(),
      ],
      programId: StakeProgramConst.programId);
}