@kamino-finance/klend-sdk 2.10.16 → 2.10.17

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.
@@ -7,7 +7,7 @@ import { KaminoReserve } from './reserve';
7
7
  export declare const POSITION_LIMIT = 10;
8
8
  export declare const BORROWS_LIMIT = 5;
9
9
  export declare const DEPOSITS_LIMIT = 8;
10
- export type ActionType = 'deposit' | 'borrow' | 'withdraw' | 'repay' | 'mint' | 'redeem' | 'depositCollateral' | 'liquidate' | 'depositAndBorrow' | 'repayAndWithdraw' | 'refreshObligation' | 'withdrawReferrerFees';
10
+ export type ActionType = 'deposit' | 'borrow' | 'withdraw' | 'repay' | 'mint' | 'redeem' | 'depositCollateral' | 'liquidate' | 'depositAndBorrow' | 'repayAndWithdraw' | 'refreshObligation' | 'requestElevationGroup' | 'withdrawReferrerFees';
11
11
  export declare class KaminoAction {
12
12
  kaminoMarket: KaminoMarket;
13
13
  reserve: KaminoReserve;
@@ -54,6 +54,8 @@ export declare class KaminoAction {
54
54
  private static loadObligation;
55
55
  static buildRefreshObligationTxns(kaminoMarket: KaminoMarket, payer: PublicKey, obligation: KaminoObligation, extraComputeBudget?: number, // if > 0 then adds the ixn
56
56
  currentSlot?: number): Promise<KaminoAction>;
57
+ static buildRequestElevationGroupTxns(kaminoMarket: KaminoMarket, payer: PublicKey, obligation: KaminoObligation, elevationGroup: number, extraComputeBudget?: number, // if > 0 then adds the ixn
58
+ currentSlot?: number): Promise<KaminoAction>;
57
59
  static buildDepositTxns(kaminoMarket: KaminoMarket, amount: string | BN, mint: PublicKey, owner: PublicKey, obligation: KaminoObligation | ObligationType, extraComputeBudget?: number, // if > 0 then adds the ixn
58
60
  includeAtaIxns?: boolean, // if true it includes create and close wsol and token atas,
59
61
  requestElevationGroup?: boolean, includeUserMetadata?: boolean, // if true it includes user metadata
@@ -161,6 +161,23 @@ class KaminoAction {
161
161
  return axn;
162
162
  });
163
163
  }
164
+ static buildRequestElevationGroupTxns(kaminoMarket, payer, obligation, elevationGroup, extraComputeBudget = 1000000, // if > 0 then adds the ixn
165
+ currentSlot = 0) {
166
+ return __awaiter(this, void 0, void 0, function* () {
167
+ const firstReserve = obligation.state.deposits[0].depositReserve;
168
+ const firstKaminoReserve = kaminoMarket.getReserveByAddress(firstReserve);
169
+ if (!firstKaminoReserve) {
170
+ throw new Error(`Reserve ${firstReserve.toBase58()} not found`);
171
+ }
172
+ const axn = yield KaminoAction.initialize('requestElevationGroup', '0', firstKaminoReserve === null || firstKaminoReserve === void 0 ? void 0 : firstKaminoReserve.getLiquidityMint(), obligation.state.owner, kaminoMarket, obligation, kaminoMarket.programId, currentSlot);
173
+ if (extraComputeBudget > 0) {
174
+ axn.addComputeBudgetIxn(extraComputeBudget);
175
+ }
176
+ axn.addRefreshObligation(payer);
177
+ axn.addRequestElevationIx(elevationGroup, true);
178
+ return axn;
179
+ });
180
+ }
164
181
  static buildDepositTxns(kaminoMarket, amount, mint, owner, obligation, extraComputeBudget = 1000000, // if > 0 then adds the ixn
165
182
  includeAtaIxns = true, // if true it includes create and close wsol and token atas,
166
183
  requestElevationGroup = false, includeUserMetadata = true, // if true it includes user metadata