StakePoolProgram.withdrawSol constructor

StakePoolProgram.withdrawSol({
  1. required SolAddress stakePool,
  2. required SolAddress sourcePoolAccount,
  3. required SolAddress withdrawAuthority,
  4. required SolAddress reserveStake,
  5. required SolAddress destinationSystemAccount,
  6. required SolAddress sourceTransferAuthority,
  7. required SolAddress managerFeeAccount,
  8. required SolAddress poolMint,
  9. required StakePoolWithdrawSolLayout layout,
  10. SolAddress? solWithdrawAuthority,
})

Withdraw SOL directly from the pool's reserve account.

Implementation

factory StakePoolProgram.withdrawSol({
  /// Stake pool
  required SolAddress stakePool,

  /// User account to burn pool tokens
  required SolAddress sourcePoolAccount,

  /// Stake pool withdraw authority
  required SolAddress withdrawAuthority,

  /// Reserve stake account, to withdraw SOL
  required SolAddress reserveStake,

  /// Account receiving the lamports from the reserve, must be a
  /// system account
  required SolAddress destinationSystemAccount,

  /// User transfer authority, for pool token account
  required SolAddress sourceTransferAuthority,

  /// Account to receive pool fee tokens
  required SolAddress managerFeeAccount,

  /// Pool token mint account
  required SolAddress poolMint,
  required StakePoolWithdrawSolLayout layout,

  /// Stake pool sol withdraw authority
  SolAddress? solWithdrawAuthority,
}) {
  return StakePoolProgram(
      layout: layout,
      keys: [
        stakePool.toWritable(),
        withdrawAuthority.toReadOnly(),
        sourceTransferAuthority.toSigner(),
        sourcePoolAccount.toWritable(),
        reserveStake.toWritable(),
        destinationSystemAccount.toWritable(),
        managerFeeAccount.toWritable(),
        poolMint.toWritable(),
        SystemProgramConst.sysvarClockPubkey.toReadOnly(),
        SystemProgramConst.sysvarStakeHistoryPubkey.toReadOnly(),
        StakeProgramConst.programId.toReadOnly(),
        SPLTokenProgramConst.tokenProgramId.toReadOnly(),
        if (solWithdrawAuthority != null) solWithdrawAuthority.toSigner()
      ],
      programId: StakePoolProgramConst.programId);
}