@kamino-finance/klend-sdk 3.2.5 → 3.2.6

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.
@@ -878,7 +878,7 @@ class KaminoAction {
878
878
  }
879
879
  addSupportIxsWithoutInitObligation(action_1, includeAtaIxns_1) {
880
880
  return __awaiter(this, arguments, void 0, function* (action, includeAtaIxns, addAsSupportIx = 'setup', requestElevationGroup = false, addInitObligationForFarm = false, isClosingPosition = false, twoTokenAction = false) {
881
- var _a;
881
+ var _a, _b;
882
882
  // TODO: why are we not doing this first?
883
883
  if (includeAtaIxns) {
884
884
  yield this.addAtaIxs(action);
@@ -1003,7 +1003,8 @@ class KaminoAction {
1003
1003
  throw new Error(`Could not find debt reserve ${this.reserve.address} in obligation`);
1004
1004
  }
1005
1005
  if (new decimal_js_1.default(repayObligationLiquidity.amount).lte(new decimal_js_1.default(this.amount.toString())) &&
1006
- this.obligation.borrows.size === 1) {
1006
+ this.obligation.borrows.size === 1 &&
1007
+ ((_a = this.obligation) === null || _a === void 0 ? void 0 : _a.state.elevationGroup) !== 0) {
1007
1008
  this.addRefreshReserveIxs(allReservesExcludingCurrent, 'cleanup');
1008
1009
  // Skip the borrow reserve, since we repay in the same tx
1009
1010
  this.addRefreshObligationIx('cleanup', true);
@@ -1038,7 +1039,7 @@ class KaminoAction {
1038
1039
  const eModeGroup = groups.find((group) => group.id === eModeGroupWithMaxLtvAndDebtReserve).id;
1039
1040
  console.log('Setting eModeGroup to', eModeGroup);
1040
1041
  let addAsSupportIx = 'inBetween';
1041
- if (eModeGroup !== 0 && eModeGroup !== ((_a = this.obligation) === null || _a === void 0 ? void 0 : _a.state.elevationGroup)) {
1042
+ if (eModeGroup !== 0 && eModeGroup !== ((_b = this.obligation) === null || _b === void 0 ? void 0 : _b.state.elevationGroup)) {
1042
1043
  if (action === 'borrow') {
1043
1044
  this.obligation.refreshedStats.potentialElevationGroupUpdate = eModeGroup;
1044
1045
  addAsSupportIx = 'setup';
@@ -1302,8 +1303,8 @@ class KaminoAction {
1302
1303
  });
1303
1304
  }
1304
1305
  addRefreshFarmsCleanupTxnIxsToCleanupIxs() {
1305
- this.cleanupIxs.splice(this.cleanupIxs.length - 1, 0, ...this.refreshFarmsCleanupTxnIxs);
1306
- this.cleanupIxsLabels.splice(this.cleanupIxsLabels.length - 1, 0, ...this.refreshFarmsCleanupTxnIxsLabels);
1306
+ this.cleanupIxs.splice(0, 0, ...this.refreshFarmsCleanupTxnIxs);
1307
+ this.cleanupIxsLabels.splice(0, 0, ...this.refreshFarmsCleanupTxnIxsLabels);
1307
1308
  }
1308
1309
  addInitObligationForFarm(reserve_1, mode_1) {
1309
1310
  return __awaiter(this, arguments, void 0, function* (reserve, mode, addAsSupportIx = 'setup') {