@kamino-finance/klend-sdk 2.13.5 → 2.13.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -154,7 +154,7 @@ class KaminoAction {
154
154
  static buildRequestElevationGroupTxns(kaminoMarket_1, payer_1, obligation_2, elevationGroup_1) {
155
155
  return __awaiter(this, arguments, void 0, function* (kaminoMarket, payer, obligation, elevationGroup, extraComputeBudget = 1000000, // if > 0 then adds the ixn
156
156
  currentSlot = 0) {
157
- const firstReserve = obligation.state.deposits[0].depositReserve;
157
+ const firstReserve = obligation.state.deposits.find((x) => !x.depositReserve.equals(web3_js_1.PublicKey.default)).depositReserve;
158
158
  const firstKaminoReserve = kaminoMarket.getReserveByAddress(firstReserve);
159
159
  if (!firstKaminoReserve) {
160
160
  throw new Error(`Reserve ${firstReserve.toBase58()} not found`);
@@ -700,7 +700,7 @@ class KaminoAction {
700
700
  userDestinationLiquidity: this.additionalTokenAccountAddress,
701
701
  borrowReserveLiquidityFeeReceiver: this.outflowReserve.state.liquidity.feeVault,
702
702
  referrerTokenState: (0, utils_1.referrerTokenStatePda)(this.referrer, this.outflowReserve.address, this.kaminoMarket.programId)[0],
703
- tokenProgram: this.reserve.getLiquidityTokenProgram(),
703
+ tokenProgram: this.outflowReserve.getLiquidityTokenProgram(),
704
704
  instructionSysvarAccount: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
705
705
  }, this.kaminoMarket.programId);
706
706
  borrowIx.keys = borrowIx.keys.concat([...depositReserveAccountMetas]);
@@ -757,7 +757,7 @@ class KaminoAction {
757
757
  userDestinationLiquidity: this.additionalTokenAccountAddress,
758
758
  placeholderUserDestinationCollateral: this.kaminoMarket.programId,
759
759
  collateralTokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
760
- liquidityTokenProgram: this.reserve.getLiquidityTokenProgram(),
760
+ liquidityTokenProgram: this.outflowReserve.getLiquidityTokenProgram(),
761
761
  instructionSysvarAccount: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
762
762
  }, this.kaminoMarket.programId));
763
763
  });
@@ -928,7 +928,7 @@ class KaminoAction {
928
928
  throw Error(`Unable to find obligation borrow to repay for ${this.obligation.state.owner.toBase58()}`);
929
929
  }
930
930
  const cumulativeBorrowRateObligation = obligation_1.KaminoObligation.getCumulativeBorrowRate(borrow);
931
- const cumulativeBorrowRateReserve = this.reserve.getEstimatedCumulativeBorrowRate(this.currentSlot);
931
+ const cumulativeBorrowRateReserve = this.reserve.getEstimatedCumulativeBorrowRate(this.currentSlot, this.kaminoMarket.state.referralFeeBps);
932
932
  const fullRepay = obligation_1.KaminoObligation.getBorrowAmount(borrow)
933
933
  .mul(cumulativeBorrowRateReserve)
934
934
  .div(cumulativeBorrowRateObligation);
@@ -1535,7 +1535,7 @@ class KaminoAction {
1535
1535
  throw Error(`Unable to find obligation borrow to repay for ${this.obligation.state.owner.toBase58()}`);
1536
1536
  }
1537
1537
  const cumulativeBorrowRateObligation = obligation_1.KaminoObligation.getCumulativeBorrowRate(borrow);
1538
- const cumulativeBorrowRateReserve = this.reserve.getEstimatedCumulativeBorrowRate(this.currentSlot);
1538
+ const cumulativeBorrowRateReserve = this.reserve.getEstimatedCumulativeBorrowRate(this.currentSlot, this.kaminoMarket.state.referralFeeBps);
1539
1539
  // TODO: shouldn't this calc be added to all other stuff as well?
1540
1540
  safeRepay = new bn_js_1.default(Math.floor(obligation_1.KaminoObligation.getBorrowAmount(borrow)
1541
1541
  .mul(cumulativeBorrowRateReserve)