@kamino-finance/klend-sdk 8.0.2 → 8.0.3

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 (71) hide show
  1. package/dist/classes/action.d.ts +46 -2
  2. package/dist/classes/action.d.ts.map +1 -1
  3. package/dist/classes/action.js +166 -28
  4. package/dist/classes/action.js.map +1 -1
  5. package/dist/classes/actionTypes.d.ts +36 -0
  6. package/dist/classes/actionTypes.d.ts.map +1 -1
  7. package/dist/classes/fraction.d.ts +16 -0
  8. package/dist/classes/fraction.d.ts.map +1 -1
  9. package/dist/classes/fraction.js +35 -0
  10. package/dist/classes/fraction.js.map +1 -1
  11. package/dist/classes/index.d.ts +1 -0
  12. package/dist/classes/index.d.ts.map +1 -1
  13. package/dist/classes/index.js +1 -0
  14. package/dist/classes/index.js.map +1 -1
  15. package/dist/classes/market.d.ts +9 -1
  16. package/dist/classes/market.d.ts.map +1 -1
  17. package/dist/classes/market.js +42 -1
  18. package/dist/classes/market.js.map +1 -1
  19. package/dist/classes/obligation.d.ts +45 -0
  20. package/dist/classes/obligation.d.ts.map +1 -1
  21. package/dist/classes/obligation.js +265 -2
  22. package/dist/classes/obligation.js.map +1 -1
  23. package/dist/classes/reserve.d.ts +72 -0
  24. package/dist/classes/reserve.d.ts.map +1 -1
  25. package/dist/classes/reserve.js +135 -0
  26. package/dist/classes/reserve.js.map +1 -1
  27. package/dist/classes/rolloverTypes.d.ts +39 -0
  28. package/dist/classes/rolloverTypes.d.ts.map +1 -0
  29. package/dist/classes/rolloverTypes.js +3 -0
  30. package/dist/classes/rolloverTypes.js.map +1 -0
  31. package/dist/lending_operations/index.d.ts +1 -0
  32. package/dist/lending_operations/index.d.ts.map +1 -1
  33. package/dist/lending_operations/index.js +1 -0
  34. package/dist/lending_operations/index.js.map +1 -1
  35. package/dist/lending_operations/redeem_drift.d.ts +87 -0
  36. package/dist/lending_operations/redeem_drift.d.ts.map +1 -0
  37. package/dist/lending_operations/redeem_drift.js +111 -0
  38. package/dist/lending_operations/redeem_drift.js.map +1 -0
  39. package/dist/lending_operations/repay_with_collateral_operations.d.ts.map +1 -1
  40. package/dist/lending_operations/repay_with_collateral_operations.js +15 -2
  41. package/dist/lending_operations/repay_with_collateral_operations.js.map +1 -1
  42. package/dist/lending_operations/swap_collateral_operations.d.ts +2 -1
  43. package/dist/lending_operations/swap_collateral_operations.d.ts.map +1 -1
  44. package/dist/lending_operations/swap_collateral_operations.js +54 -24
  45. package/dist/lending_operations/swap_collateral_operations.js.map +1 -1
  46. package/dist/lending_operations/swap_debt_operations.d.ts +170 -3
  47. package/dist/lending_operations/swap_debt_operations.d.ts.map +1 -1
  48. package/dist/lending_operations/swap_debt_operations.js +865 -47
  49. package/dist/lending_operations/swap_debt_operations.js.map +1 -1
  50. package/dist/leverage/calcs.d.ts.map +1 -1
  51. package/dist/leverage/calcs.js +7 -3
  52. package/dist/leverage/calcs.js.map +1 -1
  53. package/dist/leverage/operations.d.ts.map +1 -1
  54. package/dist/leverage/operations.js +30 -12
  55. package/dist/leverage/operations.js.map +1 -1
  56. package/package.json +2 -2
  57. package/src/classes/action.ts +219 -34
  58. package/src/classes/actionTypes.ts +37 -0
  59. package/src/classes/fraction.ts +43 -0
  60. package/src/classes/index.ts +1 -0
  61. package/src/classes/market.ts +48 -1
  62. package/src/classes/obligation.ts +336 -3
  63. package/src/classes/reserve.ts +167 -0
  64. package/src/classes/rolloverTypes.ts +61 -0
  65. package/src/lending_operations/index.ts +1 -0
  66. package/src/lending_operations/redeem_drift.ts +107 -0
  67. package/src/lending_operations/repay_with_collateral_operations.ts +19 -2
  68. package/src/lending_operations/swap_collateral_operations.ts +85 -26
  69. package/src/lending_operations/swap_debt_operations.ts +1278 -69
  70. package/src/leverage/calcs.ts +7 -3
  71. package/src/leverage/operations.ts +38 -12
@@ -8,7 +8,7 @@ import { KaminoReserve } from './reserve';
8
8
  import { ProgressCallbackType } from '../@codegen/klend/types';
9
9
  import { Scope } from '@kamino-finance/scope-sdk';
10
10
  import { ObligationOrderAtIndex } from './obligationOrder';
11
- import { BuildDepositTxnsProps, BuildBorrowTxnsProps, BuildBorrowRolloverConfigIxsProps, BuildDepositReserveLiquidityTxnsProps, BuildRedeemReserveCollateralTxnsProps, BuildWithdrawTxnsProps, BuildWithdrawFromObligationAndEnqueueTxnsProps, BuildRepayTxnsProps, BuildDepositAndBorrowTxnsProps, BuildRefreshObligationTxnsProps, BuildRequestElevationGroupTxnsProps, BuildDepositAndWithdrawV2TxnsProps, BuildRepayAndWithdrawTxnsProps, BuildRepayAndWithdrawV2TxnsProps, BuildLiquidateTxnsProps, BuildWithdrawReferrerFeeTxnsProps, BuildDepositObligationCollateralTxnsProps, BuildDepositAndSetBorrowOrderTxnsProps, InitializeActionProps } from './actionTypes';
11
+ import { BuildDepositTxnsProps, BuildBorrowTxnsProps, BuildBorrowRolloverConfigIxsProps, BuildDepositReserveLiquidityTxnsProps, BuildRedeemReserveCollateralTxnsProps, BuildWithdrawTxnsProps, BuildWithdrawFromObligationAndEnqueueTxnsProps, BuildRepayTxnsProps, BuildDepositAndBorrowTxnsProps, BuildRefreshObligationTxnsProps, BuildRolloverFixedTermBorrowTxnsProps, BuildRequestElevationGroupTxnsProps, BuildDepositAndWithdrawV2TxnsProps, BuildRepayAndWithdrawTxnsProps, BuildRepayAndWithdrawV2TxnsProps, BuildLiquidateTxnsProps, BuildWithdrawReferrerFeeTxnsProps, BuildDepositObligationCollateralTxnsProps, BuildDepositAndSetBorrowOrderTxnsProps, InitializeActionProps } from './actionTypes';
12
12
  export type ActionType = 'deposit' | 'borrow' | 'withdraw' | 'repay' | 'mint' | 'redeem' | 'depositCollateral' | 'liquidate' | 'depositAndBorrow' | 'repayAndWithdraw' | 'refreshObligation' | 'requestElevationGroup' | 'withdrawReferrerFees' | 'repayAndWithdrawV2' | 'depositAndWithdraw' | 'withdrawAndEnqueue' | 'setBorrowOrder' | 'fillBorrowOrder';
13
13
  export type AuxiliaryIx = 'setup' | 'inBetween' | 'cleanup';
14
14
  export declare class KaminoAction {
@@ -55,6 +55,36 @@ export declare class KaminoAction {
55
55
  static buildRequestElevationGroupTxns(props: BuildRequestElevationGroupTxnsProps): Promise<KaminoAction>;
56
56
  static buildDepositTxns(props: BuildDepositTxnsProps): Promise<KaminoAction>;
57
57
  static buildDepositAndSetBorrowOrderTxns(props: BuildDepositAndSetBorrowOrderTxnsProps): Promise<KaminoAction>;
58
+ /**
59
+ * Builds a transaction that rolls an existing borrow over from one reserve into another (the
60
+ * `rolloverFixedTermBorrow` instruction). The target reserve may be fixed-term or variable/open-term.
61
+ * The program requires a single signer (the `payer`) but not specifically the obligation owner, so the
62
+ * transaction can be signed by the owner directly or cranked by a keeper.
63
+ *
64
+ * The returned action includes the setup refresh/farm-init instructions and the rollover instruction.
65
+ * The program enforces several additional rollover preconditions at execution time (shared liquidity
66
+ * mint, rollover config opt-in, matching borrow factor, target rate/term limits, the market's rollover
67
+ * execution window, etc.) that this method does not pre-validate; a violation fails the transaction.
68
+ * Rollover is configured on the borrow via {@link KaminoAction.buildBorrowRolloverConfigIxs}.
69
+ */
70
+ static buildRolloverFixedTermBorrowTxns(props: BuildRolloverFixedTermBorrowTxnsProps): Promise<KaminoAction>;
71
+ /**
72
+ * Emits the setup instructions for a rollover: refreshes every reserve the obligation touches (plus the
73
+ * source and target), then refreshes the obligation. No farm-refresh instructions are emitted - the
74
+ * `rolloverFixedTermBorrow` handler refreshes the source and target debt farms internally. The source's
75
+ * and target's debt obligation farm-user-states are initialized first if missing, since that internal
76
+ * refresh loads them and fails if absent (the source's usually already exists from its borrow, but not
77
+ * guaranteed if its debt farm was added later); both inits are idempotent no-ops when already present.
78
+ *
79
+ * When a {@link ScopePriceRefreshConfig} is provided, the Scope price refresh is prepended so the reserve
80
+ * refreshes below (which read the Scope feed) succeed for Scope-priced reserves.
81
+ */
82
+ private addRolloverFixedTermBorrowSupportIxs;
83
+ /**
84
+ * Appends the `rolloverFixedTermBorrow` instruction, resolving the source/target reserve vaults and
85
+ * their debt-farm accounts (the on-chain handler refreshes debt farms only).
86
+ */
87
+ private addRolloverFixedTermBorrowIx;
58
88
  addScopeRefreshIxs(scope: Scope, tokens: number[], scopeConfig: Address): Promise<void>;
59
89
  /**
60
90
  * Add the opt-in borrow support instructions used when creating and filling a borrow order from vaults.
@@ -184,7 +214,7 @@ export declare class KaminoAction {
184
214
  addRepayAndWithdrawIxsV2(withdrawCollateralAmount: BN): Promise<void>;
185
215
  addLiquidateIx(maxAllowedLtvOverridePercent?: number): Promise<void>;
186
216
  addLiquidateIxV2(maxAllowedLtvOverridePercent?: number): Promise<void>;
187
- addInBetweenIxs(action: ActionType, includeAtaIxs: boolean, requestElevationGroup: boolean, addInitObligationForFarm: boolean, useV2Ixs: boolean): Promise<void>;
217
+ addInBetweenIxs(action: ActionType, includeAtaIxs: boolean, requestElevationGroup: boolean, addInitObligationForFarm: boolean, useV2Ixs: boolean, overrideElevationGroupRequest?: number): Promise<void>;
188
218
  addRefreshObligation(crank: TransactionSigner): Promise<void>;
189
219
  addSupportIxsWithoutInitObligation(action: ActionType, includeAtaIxs: boolean, useV2Ixs: boolean, addAsSupportIx?: AuxiliaryIx, requestElevationGroup?: boolean, addInitObligationForFarm?: boolean, twoTokenAction?: boolean, overrideElevationGroupRequest?: number): Promise<void>;
190
220
  addSupportIxs(action: ActionType, includeAtaIxs: boolean, requestElevationGroup: boolean, addInitObligationForFarm: boolean, useV2Ixs: boolean, scopeRefreshConfig: ScopePriceRefreshConfig | undefined, initUserMetadata: {
@@ -205,6 +235,20 @@ export declare class KaminoAction {
205
235
  private addRefreshFarmsForReserve;
206
236
  private addRefreshFarmsCleanupTxnIxsToCleanupIxs;
207
237
  private addInitObligationForFarm;
238
+ /**
239
+ * Appends already-built init-obligation-for-farm instructions (from {@link buildInitObligationForFarmIxs}) to
240
+ * the setup or in-between ix list. Callers that build several reserves' ixs concurrently use this to append
241
+ * them in a deterministic order afterwards.
242
+ */
243
+ private pushInitObligationForFarmIxs;
244
+ /**
245
+ * Builds the `initObligationFarmsForReserve` instruction(s) needed for this reserve's farm of the given kind,
246
+ * without mutating the action. Returns an entry only when the reserve has that farm and the obligation's
247
+ * farm-user-state does not yet exist (so it is a no-op when already initialized); at most one entry today.
248
+ * Being side-effect free, it lets callers fetch the existence checks for several reserves concurrently and
249
+ * then append the resulting ixs in a deterministic order via {@link pushInitObligationForFarmIxs}.
250
+ */
251
+ private buildInitObligationForFarmIxs;
208
252
  private addInitObligationIxs;
209
253
  private addInitUserMetadataIxs;
210
254
  private addInitReferrerTokenStateIx;
@@ -1 +1 @@
1
- {"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/classes/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,OAAO,EAEP,WAAW,EACX,WAAW,EAIX,MAAM,EACN,IAAI,EAEJ,iBAAiB,EAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,OAAO,CAAC;AA+CvB,OAAO,EAWL,cAAc,EAGd,uBAAuB,EAMxB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EAA8B,YAAY,EAAE,MAAM,UAAU,CAAC;AACpE,OAAO,EAAsB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAA+C,MAAM,yBAAyB,CAAC;AAG5G,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAU3D,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,iCAAiC,EACjC,qCAAqC,EACrC,qCAAqC,EACrC,sBAAsB,EACtB,8CAA8C,EAC9C,mBAAmB,EACnB,8BAA8B,EAC9B,+BAA+B,EAC/B,mCAAmC,EACnC,kCAAkC,EAClC,8BAA8B,EAC9B,gCAAgC,EA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AAa,GAAG,OAAO,CAAC,OAAO,CAAC;IAQpE,4BAA4B,CAAC,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAIrF,+BAA+B,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC;WAI3D,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,KAAK,CAAC,WAAW,CAAC;WAQrD,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,KAAK,CAAC,WAAW,CAAC;WAW5D,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC;WAQrD,uBAAuB,CAAC,MAAM,EAAE,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC;mBAWrD,yBAAyB;mBAoDzB,cAAc;mBAsBd,gCAAgC;CAUtD"}
@@ -223,6 +223,128 @@ class KaminoAction {
223
223
  axn.postLendingIxsLabels.push('setBorrowOrder');
224
224
  return axn;
225
225
  }
226
+ /**
227
+ * Builds a transaction that rolls an existing borrow over from one reserve into another (the
228
+ * `rolloverFixedTermBorrow` instruction). The target reserve may be fixed-term or variable/open-term.
229
+ * The program requires a single signer (the `payer`) but not specifically the obligation owner, so the
230
+ * transaction can be signed by the owner directly or cranked by a keeper.
231
+ *
232
+ * The returned action includes the setup refresh/farm-init instructions and the rollover instruction.
233
+ * The program enforces several additional rollover preconditions at execution time (shared liquidity
234
+ * mint, rollover config opt-in, matching borrow factor, target rate/term limits, the market's rollover
235
+ * execution window, etc.) that this method does not pre-validate; a violation fails the transaction.
236
+ * Rollover is configured on the borrow via {@link KaminoAction.buildBorrowRolloverConfigIxs}.
237
+ */
238
+ static async buildRolloverFixedTermBorrowTxns(props) {
239
+ const { kaminoMarket, obligation, sourceReserveAddress, targetReserveAddress, payer, scopeRefreshConfig, extraComputeBudget = 1_000_000, currentSlot, } = props;
240
+ const sourceReserve = kaminoMarket.getReserveByAddress(sourceReserveAddress);
241
+ if (!sourceReserve) {
242
+ throw new Error(`Source reserve ${sourceReserveAddress} not found in market ${kaminoMarket.getAddress()}`);
243
+ }
244
+ const targetReserve = kaminoMarket.getReserveByAddress(targetReserveAddress);
245
+ if (!targetReserve) {
246
+ throw new Error(`Target reserve ${targetReserveAddress} not found in market ${kaminoMarket.getAddress()}`);
247
+ }
248
+ // The rollover only ever moves liquidity between the two reserves' vaults (it never touches a user
249
+ // token account), so the program rejects a mint mismatch. Fail early with a clearer message.
250
+ if (sourceReserve.getLiquidityMint() !== targetReserve.getLiquidityMint()) {
251
+ throw new Error(`Rollover target reserve ${targetReserveAddress} liquidity mint ${targetReserve.getLiquidityMint()} does not match source reserve ${sourceReserveAddress} mint ${sourceReserve.getLiquidityMint()}`);
252
+ }
253
+ const axn = await KaminoAction.initialize({
254
+ kaminoMarket,
255
+ action: 'refreshObligation',
256
+ amount: '0',
257
+ reserveAddress: sourceReserve.address,
258
+ // The rollover's only signer is `payer`; this owner slot just supplies the owner pubkey for
259
+ // PDA/account derivation and never signs (the caller passes the owner as `payer` if they sign).
260
+ owner: (0, signer_1.noopSigner)(obligation.state.owner),
261
+ obligation,
262
+ currentSlot,
263
+ payer,
264
+ });
265
+ if (extraComputeBudget > 0) {
266
+ axn.addComputeBudgetIx(extraComputeBudget);
267
+ }
268
+ await axn.addRolloverFixedTermBorrowSupportIxs(sourceReserve, targetReserve, scopeRefreshConfig);
269
+ await axn.addRolloverFixedTermBorrowIx(sourceReserve, targetReserve);
270
+ return axn;
271
+ }
272
+ /**
273
+ * Emits the setup instructions for a rollover: refreshes every reserve the obligation touches (plus the
274
+ * source and target), then refreshes the obligation. No farm-refresh instructions are emitted - the
275
+ * `rolloverFixedTermBorrow` handler refreshes the source and target debt farms internally. The source's
276
+ * and target's debt obligation farm-user-states are initialized first if missing, since that internal
277
+ * refresh loads them and fails if absent (the source's usually already exists from its borrow, but not
278
+ * guaranteed if its debt farm was added later); both inits are idempotent no-ops when already present.
279
+ *
280
+ * When a {@link ScopePriceRefreshConfig} is provided, the Scope price refresh is prepended so the reserve
281
+ * refreshes below (which read the Scope feed) succeed for Scope-priced reserves.
282
+ */
283
+ async addRolloverFixedTermBorrowSupportIxs(sourceReserve, targetReserve, scopeRefreshConfig) {
284
+ // The source's and target's existence checks are independent, so run them concurrently; append the ixs
285
+ // source-then-target afterwards to keep the emitted order deterministic.
286
+ const [sourceInitIxs, targetInitIxs] = await Promise.all([
287
+ this.buildInitObligationForFarmIxs(sourceReserve, types_1.ReserveFarmKind.Debt),
288
+ this.buildInitObligationForFarmIxs(targetReserve, types_1.ReserveFarmKind.Debt),
289
+ ]);
290
+ this.pushInitObligationForFarmIxs([...sourceInitIxs, ...targetInitIxs], 'setup');
291
+ // Refresh every reserve the obligation touches (the source is already among its borrows) plus the
292
+ // target, which may be new to the obligation.
293
+ const reservesToRefresh = [
294
+ ...new Set([...this.depositReserves, ...this.borrowReserves, targetReserve.address]),
295
+ ];
296
+ // For Scope-priced reserves the refreshReserve ixs below read the Scope price feed, which must have been
297
+ // refreshed earlier in the transaction; prepend the Scope refresh covering this same reserve set (the
298
+ // target included). addScopeRefreshIxs unshifts, so it lands ahead of the reserve refreshes.
299
+ const scopeTokensMap = (0, market_1.getTokenIdsForScopeRefresh)(this.kaminoMarket, reservesToRefresh);
300
+ if (scopeTokensMap.size > 0 && scopeRefreshConfig) {
301
+ for (const [configPubkey, config] of scopeRefreshConfig.scopeConfigurations) {
302
+ const tokenIds = scopeTokensMap.get(config.oraclePrices);
303
+ if (tokenIds && tokenIds.length > 0) {
304
+ await this.addScopeRefreshIxs(scopeRefreshConfig.scope, tokenIds, configPubkey);
305
+ }
306
+ }
307
+ }
308
+ this.addRefreshReserveIxs(reservesToRefresh, 'setup');
309
+ // refresh_obligation only validates the obligation's current reserves, so the target is intentionally
310
+ // not added here (it is refreshed as a reserve above).
311
+ await this.addRefreshObligationIx('setup');
312
+ }
313
+ /**
314
+ * Appends the `rolloverFixedTermBorrow` instruction, resolving the source/target reserve vaults and
315
+ * their debt-farm accounts (the on-chain handler refreshes debt farms only).
316
+ */
317
+ async addRolloverFixedTermBorrowIx(sourceReserve, targetReserve) {
318
+ const farmsProgramId = this.kaminoMarket.farmsProgramId;
319
+ const [obligationPda, lendingMarketAuthority] = await Promise.all([
320
+ this.getObligationPda(),
321
+ this.kaminoMarket.getLendingMarketAuthority(),
322
+ ]);
323
+ // Source and target farm accounts are independent, so resolve them concurrently.
324
+ const [{ debtFarmAccounts: sourceFarmsAccounts }, { debtFarmAccounts: targetFarmsAccounts }] = await Promise.all([
325
+ KaminoAction.getFarmAccountsForReserve(obligationPda, sourceReserve, farmsProgramId),
326
+ KaminoAction.getFarmAccountsForReserve(obligationPda, targetReserve, farmsProgramId),
327
+ ]);
328
+ const rolloverIx = (0, instructions_1.rolloverFixedTermBorrow)({
329
+ rolloverAccounts: {
330
+ payer: this.payer,
331
+ obligation: obligationPda,
332
+ lendingMarket: this.kaminoMarket.getAddress(),
333
+ lendingMarketAuthority,
334
+ sourceBorrowReserve: sourceReserve.address,
335
+ targetBorrowReserve: targetReserve.address,
336
+ liquidityMint: sourceReserve.getLiquidityMint(),
337
+ sourceBorrowReserveLiquidity: sourceReserve.state.liquidity.supplyVault,
338
+ targetBorrowReserveLiquidity: targetReserve.state.liquidity.supplyVault,
339
+ tokenProgram: sourceReserve.getLiquidityTokenProgram(),
340
+ },
341
+ sourceFarmsAccounts,
342
+ targetFarmsAccounts,
343
+ farmsProgram: farmsProgramId,
344
+ }, undefined, this.kaminoMarket.programId);
345
+ this.lendingIxs.push(rolloverIx);
346
+ this.lendingIxsLabels.push(`rolloverFixedTermBorrow[source=${sourceReserve.address}, target=${targetReserve.address}]`);
347
+ }
226
348
  async addScopeRefreshIxs(scope, tokens, scopeConfig) {
227
349
  const refreshIx = await scope.refreshPriceListIx({ config: scopeConfig }, tokens);
228
350
  if (refreshIx) {
@@ -357,7 +479,7 @@ class KaminoAction {
357
479
  return axn;
358
480
  }
359
481
  static async buildDepositAndBorrowTxns(props) {
360
- const { kaminoMarket, depositAmount, depositReserveAddress, borrowAmount, borrowReserveAddress, owner, obligation, useV2Ixs, scopeRefreshConfig, extraComputeBudget = 1_000_000, includeAtaIxs = true, requestElevationGroup = false, initUserMetadata = { skipInitialization: false, skipLutCreation: false }, referrer = (0, kit_1.none)(), currentSlot, rollOver = false, } = props;
482
+ const { kaminoMarket, depositAmount, depositReserveAddress, borrowAmount, borrowReserveAddress, owner, obligation, useV2Ixs, scopeRefreshConfig, extraComputeBudget = 1_000_000, includeAtaIxs = true, requestElevationGroup = false, overrideElevationGroupRequest, initUserMetadata = { skipInitialization: false, skipLutCreation: false }, referrer = (0, kit_1.none)(), currentSlot, rollOver = false, } = props;
361
483
  const axn = await KaminoAction.initializeMultiTokenAction(kaminoMarket, 'depositAndBorrow', depositAmount, depositReserveAddress, borrowReserveAddress, owner, owner.address, obligation, borrowAmount, referrer, currentSlot);
362
484
  const addInitObligationForFarmForDeposit = true;
363
485
  const addInitObligationForFarmForBorrow = false;
@@ -379,7 +501,7 @@ class KaminoAction {
379
501
  else {
380
502
  await axn.addDepositAndBorrowIx();
381
503
  }
382
- await axn.addInBetweenIxs('depositAndBorrow', includeAtaIxs, requestElevationGroup, addInitObligationForFarmForBorrow, useV2Ixs);
504
+ await axn.addInBetweenIxs('depositAndBorrow', includeAtaIxs, requestElevationGroup, addInitObligationForFarmForBorrow, useV2Ixs, overrideElevationGroupRequest);
383
505
  if (rollOver && axn.outflowReserve?.getKind().isFixedRate()) {
384
506
  const obligationAddress = await axn.getObligationPda();
385
507
  const rolloverIxs = KaminoAction.buildBorrowRolloverConfigIxs({
@@ -1680,8 +1802,8 @@ class KaminoAction {
1680
1802
  };
1681
1803
  this.lendingIxs.push(liquidateIx);
1682
1804
  }
1683
- async addInBetweenIxs(action, includeAtaIxs, requestElevationGroup, addInitObligationForFarm, useV2Ixs) {
1684
- await this.addSupportIxsWithoutInitObligation(action, includeAtaIxs, useV2Ixs, 'inBetween', requestElevationGroup, addInitObligationForFarm);
1805
+ async addInBetweenIxs(action, includeAtaIxs, requestElevationGroup, addInitObligationForFarm, useV2Ixs, overrideElevationGroupRequest) {
1806
+ await this.addSupportIxsWithoutInitObligation(action, includeAtaIxs, useV2Ixs, 'inBetween', requestElevationGroup, addInitObligationForFarm, false, overrideElevationGroupRequest);
1685
1807
  }
1686
1808
  async addRefreshObligation(crank) {
1687
1809
  const uniqueReserveAddresses = [...new Set(this.depositReserves.concat(this.borrowReserves))];
@@ -1994,19 +2116,11 @@ class KaminoAction {
1994
2116
  return newElevationGroup;
1995
2117
  }
1996
2118
  getPreferredElevationGroupForBorrowPair(collReserve, debtReserve) {
1997
- const commonElevationGroups = this.kaminoMarket.getCommonElevationGroupsForPair(collReserve, debtReserve);
1998
- if (commonElevationGroups.length === 0) {
2119
+ const selectedElevationGroupId = this.kaminoMarket.getPreferredElevationGroupForBorrowPair(collReserve, debtReserve);
2120
+ if (selectedElevationGroupId === 0) {
1999
2121
  console.log('No common elevation groups found, staying with default');
2000
2122
  return undefined;
2001
2123
  }
2002
- let selectedElevationGroupId;
2003
- let selectedMaxLtvPct = -1;
2004
- for (const group of this.kaminoMarket.state.elevationGroups) {
2005
- if (commonElevationGroups.includes(group.id) && group.ltvPct > selectedMaxLtvPct) {
2006
- selectedElevationGroupId = group.id;
2007
- selectedMaxLtvPct = group.ltvPct;
2008
- }
2009
- }
2010
2124
  return selectedElevationGroupId;
2011
2125
  }
2012
2126
  static optionalAccount(pubkey) {
@@ -2218,6 +2332,33 @@ class KaminoAction {
2218
2332
  this.cleanupIxsLabels.splice(0, 0, ...this.refreshFarmsCleanupTxnIxsLabels);
2219
2333
  }
2220
2334
  async addInitObligationForFarm(reserve, mode, addAsSupportIx = 'setup') {
2335
+ this.pushInitObligationForFarmIxs(await this.buildInitObligationForFarmIxs(reserve, mode), addAsSupportIx);
2336
+ }
2337
+ /**
2338
+ * Appends already-built init-obligation-for-farm instructions (from {@link buildInitObligationForFarmIxs}) to
2339
+ * the setup or in-between ix list. Callers that build several reserves' ixs concurrently use this to append
2340
+ * them in a deterministic order afterwards.
2341
+ */
2342
+ pushInitObligationForFarmIxs(initIxs, addAsSupportIx) {
2343
+ for (const { ix, label } of initIxs) {
2344
+ if (addAsSupportIx === 'setup') {
2345
+ this.setupIxs.push(ix);
2346
+ this.setupIxsLabels.push(label);
2347
+ }
2348
+ else if (addAsSupportIx === 'inBetween') {
2349
+ this.inBetweenIxs.push(ix);
2350
+ this.inBetweenIxsLabels.push(label);
2351
+ }
2352
+ }
2353
+ }
2354
+ /**
2355
+ * Builds the `initObligationFarmsForReserve` instruction(s) needed for this reserve's farm of the given kind,
2356
+ * without mutating the action. Returns an entry only when the reserve has that farm and the obligation's
2357
+ * farm-user-state does not yet exist (so it is a no-op when already initialized); at most one entry today.
2358
+ * Being side-effect free, it lets callers fetch the existence checks for several reserves concurrently and
2359
+ * then append the resulting ixs in a deterministic order via {@link pushInitObligationForFarmIxs}.
2360
+ */
2361
+ async buildInitObligationForFarmIxs(reserve, mode) {
2221
2362
  const farms = [];
2222
2363
  const obligationAddress = await this.getObligationPda();
2223
2364
  if (mode === types_1.ReserveFarmKind.Collateral && (0, utils_1.isNotNullPubkey)(reserve.state.farmCollateral)) {
@@ -2235,30 +2376,27 @@ class KaminoAction {
2235
2376
  }
2236
2377
  }
2237
2378
  const lendingMarketAuthority = await this.kaminoMarket.getLendingMarketAuthority();
2238
- farms.forEach((arg) => {
2239
- const args = { mode: arg[0] };
2379
+ return farms.map(([modeDiscriminator, reserveFarmState, obligationFarm]) => {
2380
+ const args = { mode: modeDiscriminator };
2240
2381
  const accounts = {
2241
2382
  owner: (0, obligation_1.isKaminoObligation)(this.obligation) ? this.obligation.state.owner : this.owner.address,
2242
- payer: this.owner,
2383
+ // The farm user-state account is rent-paid by the transaction's payer, which is not necessarily
2384
+ // the obligation owner (e.g. a keeper-cranked rollover where `owner` is a non-signing noopSigner).
2385
+ payer: this.payer,
2243
2386
  obligation: obligationAddress,
2244
2387
  lendingMarketAuthority,
2245
2388
  reserve: reserve.address,
2246
- reserveFarmState: arg[1],
2247
- obligationFarm: arg[2],
2389
+ reserveFarmState,
2390
+ obligationFarm,
2248
2391
  lendingMarket: this.kaminoMarket.getAddress(),
2249
2392
  farmsProgram: this.kaminoMarket.farmsProgramId,
2250
2393
  rent: sysvars_1.SYSVAR_RENT_ADDRESS,
2251
2394
  systemProgram: system_1.SYSTEM_PROGRAM_ADDRESS,
2252
2395
  };
2253
- const initObligationForFarm = (0, instructions_1.initObligationFarmsForReserve)(args, accounts, [], this.kaminoMarket.programId);
2254
- if (addAsSupportIx === 'setup') {
2255
- this.setupIxs.push(initObligationForFarm);
2256
- this.setupIxsLabels.push(`InitObligationForFarm[${reserve.address.toString()}, ${obligationAddress.toString()}]`);
2257
- }
2258
- else if (addAsSupportIx === 'inBetween') {
2259
- this.inBetweenIxs.push(initObligationForFarm);
2260
- this.inBetweenIxsLabels.push(`InitObligationForFarm[${reserve.address.toString()}, ${obligationAddress.toString()}]`);
2261
- }
2396
+ return {
2397
+ ix: (0, instructions_1.initObligationFarmsForReserve)(args, accounts, [], this.kaminoMarket.programId),
2398
+ label: `InitObligationForFarm[${reserve.address.toString()}, ${obligationAddress.toString()}]`,
2399
+ };
2262
2400
  });
2263
2401
  }
2264
2402
  async addInitObligationIxs() {