@kamino-finance/klend-sdk 2.12.1 → 2.12.2

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.
Files changed (78) hide show
  1. package/dist/classes/action.js +81 -82
  2. package/dist/classes/action.js.map +1 -1
  3. package/dist/classes/fraction.js.map +1 -1
  4. package/dist/classes/jupiterPerps.js.map +1 -1
  5. package/dist/classes/market.js +10 -9
  6. package/dist/classes/market.js.map +1 -1
  7. package/dist/classes/obligation.js.map +1 -1
  8. package/dist/classes/reserve.js.map +1 -1
  9. package/dist/classes/shared.js +1 -1
  10. package/dist/classes/shared.js.map +1 -1
  11. package/dist/classes/utils.js.map +1 -1
  12. package/dist/idl_codegen/accounts/LendingMarket.js +4 -4
  13. package/dist/idl_codegen/accounts/LendingMarket.js.map +1 -1
  14. package/dist/idl_codegen/accounts/Obligation.js +4 -4
  15. package/dist/idl_codegen/accounts/Obligation.js.map +1 -1
  16. package/dist/idl_codegen/accounts/ReferrerState.js +4 -4
  17. package/dist/idl_codegen/accounts/ReferrerState.js.map +1 -1
  18. package/dist/idl_codegen/accounts/ReferrerTokenState.js +4 -4
  19. package/dist/idl_codegen/accounts/ReferrerTokenState.js.map +1 -1
  20. package/dist/idl_codegen/accounts/Reserve.js +4 -4
  21. package/dist/idl_codegen/accounts/Reserve.js.map +1 -1
  22. package/dist/idl_codegen/accounts/ShortUrl.js +4 -4
  23. package/dist/idl_codegen/accounts/ShortUrl.js.map +1 -1
  24. package/dist/idl_codegen/accounts/UserMetadata.js +4 -4
  25. package/dist/idl_codegen/accounts/UserMetadata.js.map +1 -1
  26. package/dist/idl_codegen/accounts/UserState.js +4 -4
  27. package/dist/idl_codegen/accounts/UserState.js.map +1 -1
  28. package/dist/idl_codegen/errors/anchor.js.map +1 -1
  29. package/dist/idl_codegen/errors/custom.js.map +1 -1
  30. package/dist/idl_codegen/errors/index.js.map +1 -1
  31. package/dist/idl_codegen/types/AssetTier.js.map +1 -1
  32. package/dist/idl_codegen/types/FeeCalculation.js.map +1 -1
  33. package/dist/idl_codegen/types/ReserveFarmKind.js.map +1 -1
  34. package/dist/idl_codegen/types/ReserveStatus.js.map +1 -1
  35. package/dist/idl_codegen/types/UpdateConfigMode.js.map +1 -1
  36. package/dist/idl_codegen/types/UpdateLendingMarketConfigValue.js.map +1 -1
  37. package/dist/idl_codegen/types/UpdateLendingMarketMode.js.map +1 -1
  38. package/dist/idl_codegen/zero_padding/ObligationZP.js +4 -4
  39. package/dist/idl_codegen/zero_padding/ObligationZP.js.map +1 -1
  40. package/dist/idl_codegen_jupiter_perps/accounts/Pool.js +4 -4
  41. package/dist/idl_codegen_jupiter_perps/accounts/Pool.js.map +1 -1
  42. package/dist/lending_operations/repay_with_collateral_calcs.js.map +1 -1
  43. package/dist/lending_operations/repay_with_collateral_operations.js.map +1 -1
  44. package/dist/leverage/calcs.js +3 -3
  45. package/dist/leverage/calcs.js.map +1 -1
  46. package/dist/leverage/operations.js +5 -6
  47. package/dist/leverage/operations.js.map +1 -1
  48. package/dist/leverage/utils.js +3 -3
  49. package/dist/leverage/utils.js.map +1 -1
  50. package/dist/referrals/instructions.js +2 -2
  51. package/dist/referrals/instructions.js.map +1 -1
  52. package/dist/referrals/operations.d.ts +2 -2
  53. package/dist/referrals/operations.js +15 -15
  54. package/dist/referrals/operations.js.map +1 -1
  55. package/dist/utils/ObligationType.js +1 -1
  56. package/dist/utils/ObligationType.js.map +1 -1
  57. package/dist/utils/api.js +2 -2
  58. package/dist/utils/api.js.map +1 -1
  59. package/dist/utils/ata.js +3 -19
  60. package/dist/utils/ata.js.map +1 -1
  61. package/dist/utils/constants.js.map +1 -1
  62. package/dist/utils/instruction.d.ts +0 -1
  63. package/dist/utils/instruction.js +13 -13
  64. package/dist/utils/instruction.js.map +1 -1
  65. package/dist/utils/kamino.js +2 -24
  66. package/dist/utils/kamino.js.map +1 -1
  67. package/dist/utils/layout.js.map +1 -1
  68. package/dist/utils/lookupTable.js.map +1 -1
  69. package/dist/utils/oracle.js.map +1 -1
  70. package/dist/utils/pubkey.js.map +1 -1
  71. package/dist/utils/rpc.js.map +1 -1
  72. package/dist/utils/seeds.js.map +1 -1
  73. package/dist/utils/userMetadata.js +3 -3
  74. package/dist/utils/userMetadata.js.map +1 -1
  75. package/package.json +5 -5
  76. package/dist/utils/token.d.ts +0 -2
  77. package/dist/utils/token.js +0 -20
  78. package/dist/utils/token.js.map +0 -1
@@ -24,7 +24,6 @@ const types_1 = require("../idl_codegen/types");
24
24
  const farms_sdk_1 = require("@hubbleprotocol/farms-sdk");
25
25
  const ObligationType_1 = require("../utils/ObligationType");
26
26
  const lib_1 = require("../lib");
27
- const token_1 = require("../utils/token");
28
27
  exports.POSITION_LIMIT = 10;
29
28
  exports.BORROWS_LIMIT = 5;
30
29
  exports.DEPOSITS_LIMIT = 8;
@@ -77,8 +76,8 @@ class KaminoAction {
77
76
  this.referrer = referrer ? referrer : web3_js_1.PublicKey.default;
78
77
  this.currentSlot = currentSlot;
79
78
  }
80
- static initialize(action, amount, mint, owner, kaminoMarket, obligation, referrer = web3_js_1.PublicKey.default, currentSlot = 0, hostAta, payer) {
81
- return __awaiter(this, void 0, void 0, function* () {
79
+ static initialize(action_1, amount_1, mint_1, owner_1, kaminoMarket_1, obligation_2) {
80
+ return __awaiter(this, arguments, void 0, function* (action, amount, mint, owner, kaminoMarket, obligation, referrer = web3_js_1.PublicKey.default, currentSlot = 0, hostAta, payer) {
82
81
  const reserve = kaminoMarket.getReserveByMint(mint);
83
82
  if (reserve === undefined) {
84
83
  throw new Error(`Reserve ${mint} not found in market ${kaminoMarket.getAddress().toBase58()}`);
@@ -143,9 +142,9 @@ class KaminoAction {
143
142
  };
144
143
  });
145
144
  }
146
- static buildRefreshObligationTxns(kaminoMarket, payer, obligation, extraComputeBudget = 1000000, // if > 0 then adds the ixn
147
- currentSlot = 0) {
148
- return __awaiter(this, void 0, void 0, function* () {
145
+ static buildRefreshObligationTxns(kaminoMarket_1, payer_1, obligation_2) {
146
+ return __awaiter(this, arguments, void 0, function* (kaminoMarket, payer, obligation, extraComputeBudget = 1000000, // if > 0 then adds the ixn
147
+ currentSlot = 0) {
149
148
  // placeholder for action initialization
150
149
  const firstReserve = obligation.state.deposits[0].depositReserve;
151
150
  const firstKaminoReserve = kaminoMarket.getReserveByAddress(firstReserve);
@@ -160,9 +159,9 @@ class KaminoAction {
160
159
  return axn;
161
160
  });
162
161
  }
163
- static buildRequestElevationGroupTxns(kaminoMarket, payer, obligation, elevationGroup, extraComputeBudget = 1000000, // if > 0 then adds the ixn
164
- currentSlot = 0) {
165
- return __awaiter(this, void 0, void 0, function* () {
162
+ static buildRequestElevationGroupTxns(kaminoMarket_1, payer_1, obligation_2, elevationGroup_1) {
163
+ return __awaiter(this, arguments, void 0, function* (kaminoMarket, payer, obligation, elevationGroup, extraComputeBudget = 1000000, // if > 0 then adds the ixn
164
+ currentSlot = 0) {
166
165
  const firstReserve = obligation.state.deposits[0].depositReserve;
167
166
  const firstKaminoReserve = kaminoMarket.getReserveByAddress(firstReserve);
168
167
  if (!firstKaminoReserve) {
@@ -177,11 +176,11 @@ class KaminoAction {
177
176
  return axn;
178
177
  });
179
178
  }
180
- static buildDepositTxns(kaminoMarket, amount, mint, owner, obligation, extraComputeBudget = 1000000, // if > 0 then adds the ixn
181
- includeAtaIxns = true, // if true it includes create and close wsol and token atas,
182
- requestElevationGroup = false, includeUserMetadata = true, // if true it includes user metadata
183
- referrer = web3_js_1.PublicKey.default, currentSlot = 0) {
184
- return __awaiter(this, void 0, void 0, function* () {
179
+ static buildDepositTxns(kaminoMarket_1, amount_1, mint_1, owner_1, obligation_2) {
180
+ return __awaiter(this, arguments, void 0, function* (kaminoMarket, amount, mint, owner, obligation, extraComputeBudget = 1000000, // if > 0 then adds the ixn
181
+ includeAtaIxns = true, // if true it includes create and close wsol and token atas,
182
+ requestElevationGroup = false, includeUserMetadata = true, // if true it includes user metadata
183
+ referrer = web3_js_1.PublicKey.default, currentSlot = 0) {
185
184
  const axn = yield KaminoAction.initialize('deposit', amount, mint, owner, kaminoMarket, obligation, referrer, currentSlot);
186
185
  const addInitObligationForFarm = true;
187
186
  if (extraComputeBudget > 0) {
@@ -193,11 +192,11 @@ class KaminoAction {
193
192
  return axn;
194
193
  });
195
194
  }
196
- static buildBorrowTxns(kaminoMarket, amount, mint, owner, obligation, extraComputeBudget = 1000000, // if > 0 then adds the ixn
197
- includeAtaIxns = true, // if true it includes create and close wsol and token atas,
198
- requestElevationGroup = false, includeUserMetadata = true, // if true it includes user metadata
199
- referrer = web3_js_1.PublicKey.default, currentSlot = 0, hostAta) {
200
- return __awaiter(this, void 0, void 0, function* () {
195
+ static buildBorrowTxns(kaminoMarket_1, amount_1, mint_1, owner_1, obligation_2) {
196
+ return __awaiter(this, arguments, void 0, function* (kaminoMarket, amount, mint, owner, obligation, extraComputeBudget = 1000000, // if > 0 then adds the ixn
197
+ includeAtaIxns = true, // if true it includes create and close wsol and token atas,
198
+ requestElevationGroup = false, includeUserMetadata = true, // if true it includes user metadata
199
+ referrer = web3_js_1.PublicKey.default, currentSlot = 0, hostAta) {
201
200
  const axn = yield KaminoAction.initialize('borrow', amount, mint, owner, kaminoMarket, obligation, referrer, currentSlot, hostAta);
202
201
  const addInitObligationForFarm = true;
203
202
  if (extraComputeBudget > 0) {
@@ -209,11 +208,11 @@ class KaminoAction {
209
208
  return axn;
210
209
  });
211
210
  }
212
- static buildDepositReserveLiquidityTxns(kaminoMarket, amount, mint, owner, obligation, extraComputeBudget = 1000000, // if > 0 then adds the ixn
213
- includeAtaIxns = true, // if true it includes create and close wsol and token atas
214
- requestElevationGroup = false, includeUserMetadata = true, // if true it includes user metadata
215
- referrer = web3_js_1.PublicKey.default, currentSlot = 0) {
216
- return __awaiter(this, void 0, void 0, function* () {
211
+ static buildDepositReserveLiquidityTxns(kaminoMarket_1, amount_1, mint_1, owner_1, obligation_2) {
212
+ return __awaiter(this, arguments, void 0, function* (kaminoMarket, amount, mint, owner, obligation, extraComputeBudget = 1000000, // if > 0 then adds the ixn
213
+ includeAtaIxns = true, // if true it includes create and close wsol and token atas
214
+ requestElevationGroup = false, includeUserMetadata = true, // if true it includes user metadata
215
+ referrer = web3_js_1.PublicKey.default, currentSlot = 0) {
217
216
  const axn = yield KaminoAction.initialize('mint', amount, mint, owner, kaminoMarket, obligation, referrer, currentSlot);
218
217
  const addInitObligationForFarm = true;
219
218
  if (extraComputeBudget > 0) {
@@ -225,11 +224,11 @@ class KaminoAction {
225
224
  return axn;
226
225
  });
227
226
  }
228
- static buildRedeemReserveCollateralTxns(kaminoMarket, amount, mint, owner, obligation, extraComputeBudget = 1000000, // if > 0 then adds the ixn
229
- includeAtaIxns = true, // if true it includes create and close wsol and token atas
230
- requestElevationGroup = false, includeUserMetadata = true, // if true it includes user metadata,
231
- referrer = web3_js_1.PublicKey.default, currentSlot = 0) {
232
- return __awaiter(this, void 0, void 0, function* () {
227
+ static buildRedeemReserveCollateralTxns(kaminoMarket_1, amount_1, mint_1, owner_1, obligation_2) {
228
+ return __awaiter(this, arguments, void 0, function* (kaminoMarket, amount, mint, owner, obligation, extraComputeBudget = 1000000, // if > 0 then adds the ixn
229
+ includeAtaIxns = true, // if true it includes create and close wsol and token atas
230
+ requestElevationGroup = false, includeUserMetadata = true, // if true it includes user metadata,
231
+ referrer = web3_js_1.PublicKey.default, currentSlot = 0) {
233
232
  const axn = yield KaminoAction.initialize('redeem', amount, mint, owner, kaminoMarket, obligation, referrer, currentSlot);
234
233
  const addInitObligationForFarm = true;
235
234
  if (extraComputeBudget > 0) {
@@ -241,11 +240,11 @@ class KaminoAction {
241
240
  return axn;
242
241
  });
243
242
  }
244
- static buildDepositObligationCollateralTxns(kaminoMarket, amount, mint, owner, obligation, extraComputeBudget = 1000000, // if > 0 then adds the ixn
245
- includeAtaIxns = true, // if true it includes create and close wsol and token atas
246
- requestElevationGroup = false, includeUserMetadata = true, // if true it includes user metadata
247
- referrer = web3_js_1.PublicKey.default, currentSlot = 0) {
248
- return __awaiter(this, void 0, void 0, function* () {
243
+ static buildDepositObligationCollateralTxns(kaminoMarket_1, amount_1, mint_1, owner_1, obligation_2) {
244
+ return __awaiter(this, arguments, void 0, function* (kaminoMarket, amount, mint, owner, obligation, extraComputeBudget = 1000000, // if > 0 then adds the ixn
245
+ includeAtaIxns = true, // if true it includes create and close wsol and token atas
246
+ requestElevationGroup = false, includeUserMetadata = true, // if true it includes user metadata
247
+ referrer = web3_js_1.PublicKey.default, currentSlot = 0) {
249
248
  const axn = yield KaminoAction.initialize('depositCollateral', amount, mint, owner, kaminoMarket, obligation, referrer, currentSlot);
250
249
  const addInitObligationForFarm = true;
251
250
  if (extraComputeBudget > 0) {
@@ -257,11 +256,11 @@ class KaminoAction {
257
256
  return axn;
258
257
  });
259
258
  }
260
- static buildDepositAndBorrowTxns(kaminoMarket, depositAmount, depositMint, borrowAmount, borrowMint, payer, obligation, extraComputeBudget = 1000000, // if > 0 then adds the ixn
261
- includeAtaIxns = true, // if true it includes create and close wsol and token atas,
262
- requestElevationGroup = false, includeUserMetadata = true, // if true it includes user metadata,
263
- referrer = web3_js_1.PublicKey.default, currentSlot = 0) {
264
- return __awaiter(this, void 0, void 0, function* () {
259
+ static buildDepositAndBorrowTxns(kaminoMarket_1, depositAmount_1, depositMint_1, borrowAmount_1, borrowMint_1, payer_1, obligation_2) {
260
+ return __awaiter(this, arguments, void 0, function* (kaminoMarket, depositAmount, depositMint, borrowAmount, borrowMint, payer, obligation, extraComputeBudget = 1000000, // if > 0 then adds the ixn
261
+ includeAtaIxns = true, // if true it includes create and close wsol and token atas,
262
+ requestElevationGroup = false, includeUserMetadata = true, // if true it includes user metadata,
263
+ referrer = web3_js_1.PublicKey.default, currentSlot = 0) {
265
264
  const axn = yield KaminoAction.initializeMultiTokenAction(kaminoMarket, 'depositAndBorrow', depositAmount, depositMint, borrowMint, payer, payer, obligation, borrowAmount, referrer, currentSlot);
266
265
  const addInitObligationForFarmForDeposit = true;
267
266
  const addInitObligationForFarmForBorrow = false;
@@ -276,11 +275,11 @@ class KaminoAction {
276
275
  return axn;
277
276
  });
278
277
  }
279
- static buildRepayAndWithdrawTxns(kaminoMarket, repayAmount, repayMint, withdrawAmount, withdrawMint, payer, currentSlot, obligation, extraComputeBudget = 1000000, // if > 0 then adds the ixn
280
- includeAtaIxns = true, // if true it includes create and close wsol and token atas,
281
- requestElevationGroup = false, includeUserMetadata = true, // if true it includes user metadata,
282
- isClosingPosition = false, referrer = web3_js_1.PublicKey.default) {
283
- return __awaiter(this, void 0, void 0, function* () {
278
+ static buildRepayAndWithdrawTxns(kaminoMarket_1, repayAmount_1, repayMint_1, withdrawAmount_1, withdrawMint_1, payer_1, currentSlot_1, obligation_2) {
279
+ return __awaiter(this, arguments, void 0, function* (kaminoMarket, repayAmount, repayMint, withdrawAmount, withdrawMint, payer, currentSlot, obligation, extraComputeBudget = 1000000, // if > 0 then adds the ixn
280
+ includeAtaIxns = true, // if true it includes create and close wsol and token atas,
281
+ requestElevationGroup = false, includeUserMetadata = true, // if true it includes user metadata,
282
+ isClosingPosition = false, referrer = web3_js_1.PublicKey.default) {
284
283
  const axn = yield KaminoAction.initializeMultiTokenAction(kaminoMarket, 'repayAndWithdraw', repayAmount, repayMint, withdrawMint, payer, payer, obligation, withdrawAmount, referrer, currentSlot);
285
284
  const addInitObligationForFarmForRepay = true;
286
285
  const addInitObligationForFarmForWithdraw = false;
@@ -295,11 +294,11 @@ class KaminoAction {
295
294
  return axn;
296
295
  });
297
296
  }
298
- static buildWithdrawTxns(kaminoMarket, amount, mint, owner, obligation, extraComputeBudget = 1000000, // if > 0 then adds the ixn
299
- includeAtaIxns = true, // if true it includes create and close wsol and token atas,
300
- requestElevationGroup = false, includeUserMetadata = true, // if true it includes user metadata
301
- referrer = web3_js_1.PublicKey.default, currentSlot = 0) {
302
- return __awaiter(this, void 0, void 0, function* () {
297
+ static buildWithdrawTxns(kaminoMarket_1, amount_1, mint_1, owner_1, obligation_2) {
298
+ return __awaiter(this, arguments, void 0, function* (kaminoMarket, amount, mint, owner, obligation, extraComputeBudget = 1000000, // if > 0 then adds the ixn
299
+ includeAtaIxns = true, // if true it includes create and close wsol and token atas,
300
+ requestElevationGroup = false, includeUserMetadata = true, // if true it includes user metadata
301
+ referrer = web3_js_1.PublicKey.default, currentSlot = 0) {
303
302
  const axn = yield KaminoAction.initialize('withdraw', amount, mint, owner, kaminoMarket, obligation, referrer, currentSlot);
304
303
  const addInitObligationForFarm = true;
305
304
  if (extraComputeBudget > 0) {
@@ -326,8 +325,8 @@ class KaminoAction {
326
325
  * @param includeUserMetadata - if true it includes user metadata
327
326
  * @param referrer
328
327
  */
329
- static buildRepayTxns(kaminoMarket, amount, mint, owner, obligation, currentSlot, payer = undefined, extraComputeBudget = 1000000, includeAtaIxns = true, requestElevationGroup = false, includeUserMetadata = true, referrer = web3_js_1.PublicKey.default) {
330
- return __awaiter(this, void 0, void 0, function* () {
328
+ static buildRepayTxns(kaminoMarket_1, amount_1, mint_1, owner_1, obligation_2, currentSlot_1) {
329
+ return __awaiter(this, arguments, void 0, function* (kaminoMarket, amount, mint, owner, obligation, currentSlot, payer = undefined, extraComputeBudget = 1000000, includeAtaIxns = true, requestElevationGroup = false, includeUserMetadata = true, referrer = web3_js_1.PublicKey.default) {
331
330
  const axn = yield KaminoAction.initialize('repay', amount, mint, owner, kaminoMarket, obligation, referrer, currentSlot, undefined, payer);
332
331
  const addInitObligationForFarm = true;
333
332
  if (extraComputeBudget > 0) {
@@ -339,11 +338,11 @@ class KaminoAction {
339
338
  return axn;
340
339
  });
341
340
  }
342
- static buildLiquidateTxns(kaminoMarket, amount, minCollateralReceiveAmount, repayTokenMint, withdrawTokenMint, liquidator, obligationOwner, obligation, extraComputeBudget = 1000000, // if > 0 then adds the ixn
343
- includeAtaIxns = true, // if true it includes create and close wsol and token atas, and creates all other token atas if they don't exist
344
- requestElevationGroup = false, includeUserMetadata = true, // if true it includes user metadata
345
- referrer = web3_js_1.PublicKey.default, maxAllowedLtvOverridePercent = 0, currentSlot = 0) {
346
- return __awaiter(this, void 0, void 0, function* () {
341
+ static buildLiquidateTxns(kaminoMarket_1, amount_1, minCollateralReceiveAmount_1, repayTokenMint_1, withdrawTokenMint_1, liquidator_1, obligationOwner_1, obligation_2) {
342
+ return __awaiter(this, arguments, void 0, function* (kaminoMarket, amount, minCollateralReceiveAmount, repayTokenMint, withdrawTokenMint, liquidator, obligationOwner, obligation, extraComputeBudget = 1000000, // if > 0 then adds the ixn
343
+ includeAtaIxns = true, // if true it includes create and close wsol and token atas, and creates all other token atas if they don't exist
344
+ requestElevationGroup = false, includeUserMetadata = true, // if true it includes user metadata
345
+ referrer = web3_js_1.PublicKey.default, maxAllowedLtvOverridePercent = 0, currentSlot = 0) {
347
346
  const axn = yield KaminoAction.initializeMultiTokenAction(kaminoMarket, 'liquidate', amount, repayTokenMint, withdrawTokenMint, liquidator, obligationOwner, obligation, minCollateralReceiveAmount, referrer, currentSlot);
348
347
  const addInitObligationForFarm = true;
349
348
  if (extraComputeBudget > 0) {
@@ -355,8 +354,8 @@ class KaminoAction {
355
354
  return axn;
356
355
  });
357
356
  }
358
- static buildWithdrawReferrerFeeTxns(owner, tokenMint, kaminoMarket, currentSlot = 0) {
359
- return __awaiter(this, void 0, void 0, function* () {
357
+ static buildWithdrawReferrerFeeTxns(owner_1, tokenMint_1, kaminoMarket_1) {
358
+ return __awaiter(this, arguments, void 0, function* (owner, tokenMint, kaminoMarket, currentSlot = 0) {
360
359
  const { axn, createAtasIxns } = yield KaminoAction.initializeWithdrawReferrerFees(tokenMint, owner, kaminoMarket, currentSlot);
361
360
  axn.preTxnIxs.push(...createAtasIxns);
362
361
  axn.preTxnIxsLabels.push(`createAtasIxs[${axn.userTokenAccountAddress.toString()}]`);
@@ -446,7 +445,7 @@ class KaminoAction {
446
445
  reserveLiquidityMint: this.reserve.getLiquidityMint(),
447
446
  reserveLiquiditySupply: this.reserve.state.liquidity.supplyVault,
448
447
  reserveCollateralMint: this.reserve.getCTokenMint(),
449
- reserveDestinationDepositCollateral: this.reserve.state.collateral.supplyVault,
448
+ reserveDestinationDepositCollateral: this.reserve.state.collateral.supplyVault, // destinationCollateral
450
449
  userSourceLiquidity: this.userTokenAccountAddress,
451
450
  placeholderUserDestinationCollateral: this.kaminoMarket.programId,
452
451
  collateralTokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
@@ -550,7 +549,7 @@ class KaminoAction {
550
549
  reserveLiquidityMint: this.reserve.getLiquidityMint(),
551
550
  reserveLiquiditySupply: this.reserve.state.liquidity.supplyVault,
552
551
  reserveCollateralMint: this.reserve.getCTokenMint(),
553
- reserveDestinationDepositCollateral: this.reserve.state.collateral.supplyVault,
552
+ reserveDestinationDepositCollateral: this.reserve.state.collateral.supplyVault, // destinationCollateral
554
553
  userSourceLiquidity: this.userTokenAccountAddress,
555
554
  placeholderUserDestinationCollateral: this.kaminoMarket.programId,
556
555
  collateralTokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
@@ -676,8 +675,8 @@ class KaminoAction {
676
675
  });
677
676
  }
678
677
  addRepayIx() {
679
- var _a;
680
678
  return __awaiter(this, void 0, void 0, function* () {
679
+ var _a;
681
680
  this.lendingIxsLabels.push(`repayObligationLiquidity(reserve=${this.reserve.address})(obligation=${this.getObligationPda()})`);
682
681
  const depositReservesList = this.getAdditionalDepositReservesList();
683
682
  const depositReserveAccountMetas = depositReservesList.map((reserve) => {
@@ -701,9 +700,9 @@ class KaminoAction {
701
700
  this.lendingIxs.push(repayIx);
702
701
  });
703
702
  }
704
- addLiquidateIx(maxAllowedLtvOverridePercent = 0) {
705
- var _a;
706
- return __awaiter(this, void 0, void 0, function* () {
703
+ addLiquidateIx() {
704
+ return __awaiter(this, arguments, void 0, function* (maxAllowedLtvOverridePercent = 0) {
705
+ var _a;
707
706
  this.lendingIxsLabels.push(`liquidateObligationAndRedeemReserveCollateral`);
708
707
  if (!this.outflowReserve) {
709
708
  throw Error(`Withdraw reserve during liquidation is not defined`);
@@ -749,8 +748,8 @@ class KaminoAction {
749
748
  this.lendingIxs.push(liquidateIx);
750
749
  });
751
750
  }
752
- addInBetweenIxs(action, includeAtaIxns, requestElevationGroup, addInitObligationForFarm, isClosingPosition = false) {
753
- return __awaiter(this, void 0, void 0, function* () {
751
+ addInBetweenIxs(action_1, includeAtaIxns_1, requestElevationGroup_1, addInitObligationForFarm_1) {
752
+ return __awaiter(this, arguments, void 0, function* (action, includeAtaIxns, requestElevationGroup, addInitObligationForFarm, isClosingPosition = false) {
754
753
  yield this.addSupportIxsWithoutInitObligation(action, includeAtaIxns, false, requestElevationGroup, addInitObligationForFarm, isClosingPosition);
755
754
  });
756
755
  }
@@ -764,9 +763,9 @@ class KaminoAction {
764
763
  this.addRefreshFarmsForReserve(this.borrowReserves.map((r) => this.kaminoMarket.getReserveByAddress(r)), addAllToSetupIxns, types_1.ReserveFarmKind.Debt, crank);
765
764
  this.addRefreshObligationIx(addAllToSetupIxns, false);
766
765
  }
767
- addSupportIxsWithoutInitObligation(action, includeAtaIxns, addToSetupIxs = true, requestElevationGroup = false, addInitObligationForFarm = false, isClosingPosition = false, twoTokenAction = false) {
768
- var _a;
769
- return __awaiter(this, void 0, void 0, function* () {
766
+ addSupportIxsWithoutInitObligation(action_1, includeAtaIxns_1) {
767
+ return __awaiter(this, arguments, void 0, function* (action, includeAtaIxns, addToSetupIxs = true, requestElevationGroup = false, addInitObligationForFarm = false, isClosingPosition = false, twoTokenAction = false) {
768
+ var _a;
770
769
  // TODO: why are we not doing this first?
771
770
  if (includeAtaIxns) {
772
771
  yield this.addAtaIxs(action);
@@ -947,8 +946,8 @@ class KaminoAction {
947
946
  }
948
947
  });
949
948
  }
950
- addSupportIxs(action, includeAtaIxns, requestElevationGroup, includeUserMetadata, addInitObligationForFarm, twoTokenAction = false) {
951
- return __awaiter(this, void 0, void 0, function* () {
949
+ addSupportIxs(action_1, includeAtaIxns_1, requestElevationGroup_1, includeUserMetadata_1, addInitObligationForFarm_1) {
950
+ return __awaiter(this, arguments, void 0, function* (action, includeAtaIxns, requestElevationGroup, includeUserMetadata, addInitObligationForFarm, twoTokenAction = false) {
952
951
  if (!['mint', 'redeem'].includes(action)) {
953
952
  const [, ownerUserMetadata] = yield this.kaminoMarket.getUserMetadata(this.owner);
954
953
  if (!ownerUserMetadata && includeUserMetadata) {
@@ -1154,8 +1153,8 @@ class KaminoAction {
1154
1153
  this.cleanupIxs.splice(this.cleanupIxs.length - 1, 0, ...this.refreshFarmsCleanupTxnIxs);
1155
1154
  this.cleanupIxsLabels.splice(this.cleanupIxsLabels.length - 1, 0, ...this.refreshFarmsCleanupTxnIxsLabels);
1156
1155
  }
1157
- addInitObligationForFarm(reserve, mode, addToSetupIxs = true) {
1158
- return __awaiter(this, void 0, void 0, function* () {
1156
+ addInitObligationForFarm(reserve_1, mode_1) {
1157
+ return __awaiter(this, arguments, void 0, function* (reserve, mode, addToSetupIxs = true) {
1159
1158
  const BASE_SEED_USER_STATE = Buffer.from('user');
1160
1159
  const getPda = (farm) => web3_js_1.PublicKey.findProgramAddressSync([BASE_SEED_USER_STATE, farm.toBytes(), this.getObligationPda().toBytes()], farms_sdk_1.farmsId)[0];
1161
1160
  const farms = [];
@@ -1249,8 +1248,8 @@ class KaminoAction {
1249
1248
  this.setupIxsLabels.push(`initUserMetadata[${userMetadataAddress.toString()}]`);
1250
1249
  });
1251
1250
  }
1252
- addInitReferrerTokenStateIxs(reservesArr = []) {
1253
- return __awaiter(this, void 0, void 0, function* () {
1251
+ addInitReferrerTokenStateIxs() {
1252
+ return __awaiter(this, arguments, void 0, function* (reservesArr = []) {
1254
1253
  if (this.referrer.equals(web3_js_1.PublicKey.default)) {
1255
1254
  return;
1256
1255
  }
@@ -1302,8 +1301,8 @@ class KaminoAction {
1302
1301
  this.setupIxsLabels.push(`AddComputeBudget[${units}]`);
1303
1302
  }
1304
1303
  addAtaIxs(action) {
1305
- var _a, _b;
1306
1304
  return __awaiter(this, void 0, void 0, function* () {
1305
+ var _a, _b;
1307
1306
  if (this.mint.equals(utils_1.WRAPPED_SOL_MINT) || ((_a = this.secondaryMint) === null || _a === void 0 ? void 0 : _a.equals(utils_1.WRAPPED_SOL_MINT))) {
1308
1307
  yield this.updateWSOLAccount(action);
1309
1308
  }
@@ -1401,8 +1400,8 @@ class KaminoAction {
1401
1400
  });
1402
1401
  }
1403
1402
  updateWSOLAccount(action) {
1404
- var _a, _b;
1405
1403
  return __awaiter(this, void 0, void 0, function* () {
1404
+ var _a, _b;
1406
1405
  const preIxs = [];
1407
1406
  const postIxs = [];
1408
1407
  const preIxsLabels = [];
@@ -1446,7 +1445,7 @@ class KaminoAction {
1446
1445
  });
1447
1446
  preIxs.push(transferLamportsIx);
1448
1447
  preIxsLabels.push(`TransferLamportsToUserAtaSOL[${userTokenAccountAddress}]`);
1449
- const closeWSOLAccountIx = (0, token_1.createCloseAccountInstruction)(userTokenAccountAddress, this.owner, this.owner, spl_token_1.TOKEN_PROGRAM_ID);
1448
+ const closeWSOLAccountIx = (0, spl_token_1.createCloseAccountInstruction)(userTokenAccountAddress, this.owner, this.owner, [], spl_token_1.TOKEN_PROGRAM_ID);
1450
1449
  const syncIx = (0, utils_1.syncNative)(userTokenAccountAddress);
1451
1450
  if (userWSOLAccountInfo) {
1452
1451
  if (sendAction) {
@@ -1481,8 +1480,8 @@ class KaminoAction {
1481
1480
  this.cleanupIxsLabels.push(...postIxsLabels);
1482
1481
  });
1483
1482
  }
1484
- static initializeMultiTokenAction(kaminoMarket, action, inflowAmount, inflowTokenMint, outflowTokenMint, payer, obligationOwner, obligation, outflowAmount, referrer = web3_js_1.PublicKey.default, currentSlot = 0) {
1485
- return __awaiter(this, void 0, void 0, function* () {
1483
+ static initializeMultiTokenAction(kaminoMarket_1, action_1, inflowAmount_1, inflowTokenMint_1, outflowTokenMint_1, payer_1, obligationOwner_1, obligation_2, outflowAmount_1) {
1484
+ return __awaiter(this, arguments, void 0, function* (kaminoMarket, action, inflowAmount, inflowTokenMint, outflowTokenMint, payer, obligationOwner, obligation, outflowAmount, referrer = web3_js_1.PublicKey.default, currentSlot = 0) {
1486
1485
  const inflowReserve = kaminoMarket.getReserveByMint(inflowTokenMint);
1487
1486
  const outflowReserve = kaminoMarket.getReserveByMint(outflowTokenMint);
1488
1487
  if (!outflowReserve || !inflowReserve) {
@@ -1528,8 +1527,8 @@ class KaminoAction {
1528
1527
  return new KaminoAction(kaminoMarket, payer, kaminoObligation || obligation, userTokenAccountAddress, userCollateralAccountAddress, primaryMint, distinctReserveCount, inflowAmount, depositReserves, borrowReserves, inflowReserve, currentSlot, undefined, secondaryMint, additionalUserTokenAccountAddress, outflowReserve, outflowAmount, referrerKey);
1529
1528
  });
1530
1529
  }
1531
- static initializeWithdrawReferrerFees(mint, owner, kaminoMarket, currentSlot = 0, hostAta) {
1532
- return __awaiter(this, void 0, void 0, function* () {
1530
+ static initializeWithdrawReferrerFees(mint_1, owner_1, kaminoMarket_1) {
1531
+ return __awaiter(this, arguments, void 0, function* (mint, owner, kaminoMarket, currentSlot = 0, hostAta) {
1533
1532
  const reserve = kaminoMarket.getReserveByMint(mint);
1534
1533
  if (reserve === undefined) {
1535
1534
  throw new Error(`Reserve ${mint} not found in market ${kaminoMarket.getAddress().toBase58()}`);