@kamino-finance/klend-sdk 7.0.7 → 7.0.9

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 (36) hide show
  1. package/dist/classes/action.d.ts +1 -1
  2. package/dist/classes/action.d.ts.map +1 -1
  3. package/dist/classes/action.js +15 -15
  4. package/dist/classes/action.js.map +1 -1
  5. package/dist/classes/obligation.js +7 -6
  6. package/dist/classes/obligation.js.map +1 -1
  7. package/dist/classes/vault.d.ts.map +1 -1
  8. package/dist/classes/vault.js +0 -1
  9. package/dist/classes/vault.js.map +1 -1
  10. package/dist/lending_operations/repay_with_collateral_operations.d.ts.map +1 -1
  11. package/dist/lending_operations/repay_with_collateral_operations.js +36 -32
  12. package/dist/lending_operations/repay_with_collateral_operations.js.map +1 -1
  13. package/dist/lending_operations/swap_collateral_operations.d.ts.map +1 -1
  14. package/dist/lending_operations/swap_collateral_operations.js +6 -6
  15. package/dist/lending_operations/swap_collateral_operations.js.map +1 -1
  16. package/dist/leverage/operations.d.ts +4 -3
  17. package/dist/leverage/operations.d.ts.map +1 -1
  18. package/dist/leverage/operations.js +175 -149
  19. package/dist/leverage/operations.js.map +1 -1
  20. package/dist/leverage/types.d.ts +1 -0
  21. package/dist/leverage/types.d.ts.map +1 -1
  22. package/dist/manager/client_kamino_manager.js +5 -4
  23. package/dist/manager/client_kamino_manager.js.map +1 -1
  24. package/dist/utils/farmUtils.d.ts.map +1 -1
  25. package/dist/utils/farmUtils.js +1 -4
  26. package/dist/utils/farmUtils.js.map +1 -1
  27. package/package.json +1 -1
  28. package/src/classes/action.ts +15 -15
  29. package/src/classes/obligation.ts +9 -9
  30. package/src/classes/vault.ts +0 -1
  31. package/src/lending_operations/repay_with_collateral_operations.ts +78 -74
  32. package/src/lending_operations/swap_collateral_operations.ts +15 -13
  33. package/src/leverage/operations.ts +350 -318
  34. package/src/leverage/types.ts +1 -0
  35. package/src/manager/client_kamino_manager.ts +5 -4
  36. package/src/utils/farmUtils.ts +1 -4
@@ -189,6 +189,7 @@ export interface AdjustLeverageSwapInputsProps<QuoteResponse> extends BaseLevera
189
189
  priceCollToDebt: Decimal;
190
190
  priceDebtToColl: Decimal;
191
191
  priceAinB: PriceAinBProvider;
192
+ withdrawSlotOffset?: number;
192
193
  }
193
194
 
194
195
  export interface AdjustLeverageProps<QuoteResponse> extends AdjustLeverageSwapInputsProps<QuoteResponse> {
@@ -1303,7 +1303,8 @@ async function main() {
1303
1303
  .command('get-vault-overview')
1304
1304
  .requiredOption('--vault <string>', 'Vault address')
1305
1305
  .option(`--staging`, 'If true, will use the staging programs')
1306
- .action(async ({ vault, staging }) => {
1306
+ .option(`--token-price <number>`, 'Vault token price in USD')
1307
+ .action(async ({ vault, staging, tokenPrice }) => {
1307
1308
  const env = await initEnv(staging);
1308
1309
  const slotDuration = await getMedianSlotDurationInMsFromLastEpochs();
1309
1310
 
@@ -1313,7 +1314,7 @@ async function main() {
1313
1314
  const vaultState = await new KaminoVault(vaultAddress, undefined, env.kvaultProgramId).getState(env.c.rpc);
1314
1315
  const vaultOverview = await kaminoManager.getVaultOverview(
1315
1316
  vaultState,
1316
- new Decimal(1.0),
1317
+ new Decimal(tokenPrice),
1317
1318
  await env.c.rpc.getSlot({ commitment: 'confirmed' }).send()
1318
1319
  );
1319
1320
 
@@ -1743,8 +1744,8 @@ async function main() {
1743
1744
  const ixs = kaminoManager.updateLendingMarketIxs(signer, marketWithAddress, newLendingMarket);
1744
1745
 
1745
1746
  // executing 6 ixs in a txn to make sure they fit
1746
- for (let ixnIndex = 0; ixnIndex < ixs.length; ixnIndex += 6) {
1747
- const ixsToExecute = ixs.slice(ixnIndex, ixnIndex + 6);
1747
+ for (let ixIndex = 0; ixIndex < ixs.length; ixIndex += 6) {
1748
+ const ixsToExecute = ixs.slice(ixIndex, ixIndex + 6);
1748
1749
  await processTx(
1749
1750
  env.c,
1750
1751
  signer,
@@ -5,7 +5,6 @@ import { getFarmIncentives } from '@kamino-finance/farms-sdk/dist/utils/apy';
5
5
  import { DEFAULT_PUBLIC_KEY } from '@kamino-finance/farms-sdk';
6
6
  import { Reserve } from '../@codegen/klend/accounts';
7
7
  import { KaminoReserve } from '../lib';
8
- import { getMintDecimals } from '@kamino-finance/kliquidity-sdk';
9
8
 
10
9
  export interface ReserveIncentives {
11
10
  collateralFarmIncentives: FarmIncentives;
@@ -47,15 +46,13 @@ export async function getReserveFarmRewardsAPY(
47
46
 
48
47
  const stakedTokenMintDecimals = kaminoReserve.getMintDecimals();
49
48
  const reserveCtokenPrice = reserveLiquidityTokenPrice.div(kaminoReserve.getEstimatedCollateralExchangeRate(slot, 0));
50
- const cTokenMint = kaminoReserve.getCTokenMint();
51
- const cTokenDecimals = cTokenMintDecimals ? cTokenMintDecimals : await getMintDecimals(rpc, cTokenMint);
52
49
 
53
50
  if (farmCollateral !== DEFAULT_PUBLIC_KEY) {
54
51
  const farmIncentivesCollateral = await getFarmIncentives(
55
52
  farmsClient,
56
53
  farmCollateral,
57
54
  reserveCtokenPrice,
58
- cTokenDecimals,
55
+ stakedTokenMintDecimals,
59
56
  tokensPrices
60
57
  );
61
58
  reserveIncentives.collateralFarmIncentives = farmIncentivesCollateral;