@kamino-finance/klend-sdk 3.2.3 → 3.2.5

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.
@@ -997,40 +997,6 @@ class KaminoAction {
997
997
  else {
998
998
  this.addRefreshObligationIx(addAsSupportIx, false);
999
999
  }
1000
- if (addAsSupportIx === 'setup') {
1001
- // If this is an setup ixn (therefore not an in-between), it means it's either a one off action
1002
- // or the first of a two-token-action
1003
- if (action === 'liquidate') {
1004
- this.addRefreshFarmsForReserve([this.outflowReserve], addAsSupportIx, types_1.ReserveFarmKind.Collateral);
1005
- this.addRefreshFarmsForReserve([this.reserve], addAsSupportIx, types_1.ReserveFarmKind.Debt);
1006
- }
1007
- else if (action === 'depositAndBorrow' ||
1008
- action === 'depositCollateral' ||
1009
- action === 'withdraw' ||
1010
- action === 'deposit') {
1011
- this.addRefreshFarmsForReserve(currentReserves, addAsSupportIx, types_1.ReserveFarmKind.Collateral, undefined, twoTokenAction);
1012
- }
1013
- else if (action === 'repayAndWithdraw' || action === 'borrow' || action === 'repay') {
1014
- this.addRefreshFarmsForReserve(currentReserves, addAsSupportIx, types_1.ReserveFarmKind.Debt, undefined, twoTokenAction);
1015
- }
1016
- else {
1017
- throw new Error(`Could not decide on refresh farm for action ${action}`);
1018
- }
1019
- }
1020
- else {
1021
- // If this is an inbetween, it means it's part of a two-token-action
1022
- // so we skip the refresh farm obligation of the first reserve as that operation already happened
1023
- // add added to 'setup' ixns
1024
- if (action === 'depositAndBorrow') {
1025
- this.addRefreshFarmsForReserve([this.outflowReserve], addAsSupportIx, types_1.ReserveFarmKind.Debt);
1026
- }
1027
- else if (action === 'repayAndWithdraw') {
1028
- this.addRefreshFarmsForReserve([this.outflowReserve], addAsSupportIx, types_1.ReserveFarmKind.Collateral);
1029
- }
1030
- else {
1031
- throw new Error(`Could not decide on refresh farm for action ${action}`);
1032
- }
1033
- }
1034
1000
  if (action === 'repay' && requestElevationGroup) {
1035
1001
  const repayObligationLiquidity = this.obligation.borrows.get(this.reserve.address);
1036
1002
  if (!repayObligationLiquidity) {
@@ -1084,6 +1050,40 @@ class KaminoAction {
1084
1050
  }
1085
1051
  }
1086
1052
  }
1053
+ if (addAsSupportIx === 'setup') {
1054
+ // If this is an setup ixn (therefore not an in-between), it means it's either a one off action
1055
+ // or the first of a two-token-action
1056
+ if (action === 'liquidate') {
1057
+ this.addRefreshFarmsForReserve([this.outflowReserve], addAsSupportIx, types_1.ReserveFarmKind.Collateral);
1058
+ this.addRefreshFarmsForReserve([this.reserve], addAsSupportIx, types_1.ReserveFarmKind.Debt);
1059
+ }
1060
+ else if (action === 'depositAndBorrow' ||
1061
+ action === 'depositCollateral' ||
1062
+ action === 'withdraw' ||
1063
+ action === 'deposit') {
1064
+ this.addRefreshFarmsForReserve(currentReserves, addAsSupportIx, types_1.ReserveFarmKind.Collateral, undefined, twoTokenAction);
1065
+ }
1066
+ else if (action === 'repayAndWithdraw' || action === 'borrow' || action === 'repay') {
1067
+ this.addRefreshFarmsForReserve(currentReserves, addAsSupportIx, types_1.ReserveFarmKind.Debt, undefined, twoTokenAction);
1068
+ }
1069
+ else {
1070
+ throw new Error(`Could not decide on refresh farm for action ${action}`);
1071
+ }
1072
+ }
1073
+ else {
1074
+ // If this is an inbetween, it means it's part of a two-token-action
1075
+ // so we skip the refresh farm obligation of the first reserve as that operation already happened
1076
+ // add added to 'setup' ixns
1077
+ if (action === 'depositAndBorrow') {
1078
+ this.addRefreshFarmsForReserve([this.outflowReserve], addAsSupportIx, types_1.ReserveFarmKind.Debt);
1079
+ }
1080
+ else if (action === 'repayAndWithdraw') {
1081
+ this.addRefreshFarmsForReserve([this.outflowReserve], addAsSupportIx, types_1.ReserveFarmKind.Collateral);
1082
+ }
1083
+ else {
1084
+ throw new Error(`Could not decide on refresh farm for action ${action}`);
1085
+ }
1086
+ }
1087
1087
  }
1088
1088
  });
1089
1089
  }