@kamino-finance/klend-sdk 5.10.20 → 5.10.21

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.
@@ -4,6 +4,7 @@ import { AccountInfo, PublicKey } from '@solana/web3.js';
4
4
  import { MarketOverview, ReserveOverview, SOL_MINTS } from '../lib';
5
5
  import { AccountLayout } from '@solana/spl-token';
6
6
  import { ReserveAllocationOverview } from './types';
7
+ import axios from 'axios';
7
8
 
8
9
  type ObligationFarmScoreType = {
9
10
  obligationId: string;
@@ -320,3 +321,15 @@ export function printReserveAllocationOverview(reserveAllocationOverview: Reserv
320
321
  console.log(' Token allocation cap:', reserveAllocationOverview.tokenAllocationCap.toString());
321
322
  console.log(' Ctoken allocation:', reserveAllocationOverview.ctokenAllocation.toString());
322
323
  }
324
+
325
+ export function assertNever(x: never): never {
326
+ throw new Error('Unexpected object: ' + x);
327
+ }
328
+
329
+ /**
330
+ * Fetch median slot duration in milliseconds from the last 10 epochs
331
+ */
332
+ export async function getMedianSlotDurationInMsFromLastEpochs() {
333
+ const response = await axios.get<{ recentSlotDurationInMs: number }>('https://api.kamino.finance/slots/duration');
334
+ return response.data.recentSlotDurationInMs;
335
+ }