StakeProgram.withdraw constructor

StakeProgram.withdraw({
  1. required StakeWithdrawLayout layout,
  2. required SolAddress stakePubkey,
  3. required SolAddress authorizedPubkey,
  4. required SolAddress toPubkey,
  5. SolAddress? custodianPubkey,
})

Generate a Transaction that withdraws deactivated Stake tokens.

Implementation

factory StakeProgram.withdraw(
    {required StakeWithdrawLayout layout,
    required SolAddress stakePubkey,
    required SolAddress authorizedPubkey,
    required SolAddress toPubkey,
    SolAddress? custodianPubkey}) {
  return StakeProgram(
      layout: layout,
      keys: [
        stakePubkey.toWritable(),
        toPubkey.toWritable(),
        SystemProgramConst.sysvarClockPubkey.toReadOnly(),
        SystemProgramConst.sysvarStakeHistoryPubkey.toReadOnly(),
        authorizedPubkey.toSigner(),
        if (custodianPubkey != null) custodianPubkey.toSigner(),
      ],
      programId: StakeProgramConst.programId);
}