TokenLendingProgram.withdrawObligationCollateral constructor

TokenLendingProgram.withdrawObligationCollateral({
  1. required SolAddress sourceCollateral,
  2. required SolAddress destinationCollateral,
  3. required SolAddress withdrawReserve,
  4. required SolAddress obligation,
  5. required SolAddress lendingMarket,
  6. required SolAddress lendingMarketAuthority,
  7. required SolAddress obligationOwner,
  8. required TokenLendingWithdrawObligationCollateralLayout layout,
})

Withdraw collateral from an obligation. Requires a refreshed obligation and reserve.

Implementation

factory TokenLendingProgram.withdrawObligationCollateral({
  /// Source withdraw reserve collateral supply SPL Token account.
  required SolAddress sourceCollateral,

  /// Destination collateral token account. Minted by
  /// withdraw reserve collateral mint.
  required SolAddress destinationCollateral,

  /// Withdraw reserve account.
  required SolAddress withdrawReserve,

  /// Obligation account
  required SolAddress obligation,

  /// Lending market account
  required SolAddress lendingMarket,

  /// Derived lending market authority
  required SolAddress lendingMarketAuthority,

  /// Obligation owner.
  required SolAddress obligationOwner,
  required TokenLendingWithdrawObligationCollateralLayout layout,
}) {
  return TokenLendingProgram(keys: [
    sourceCollateral.toWritable(),
    destinationCollateral.toWritable(),
    withdrawReserve.toReadOnly(),
    obligation.toWritable(),
    lendingMarket.toReadOnly(),
    lendingMarketAuthority.toReadOnly(),
    obligationOwner.toSigner(),
    SystemProgramConst.sysvarClockPubkey.toReadOnly(),
    SPLTokenProgramConst.tokenProgramId.toReadOnly(),
  ], programId: TokenLendingProgramConst.lendingProgramId, layout: layout);
}