@kamino-finance/klend-sdk 5.10.19 → 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.
- package/dist/classes/manager.d.ts +6 -1
- package/dist/classes/manager.d.ts.map +1 -1
- package/dist/classes/manager.js +85 -60
- package/dist/classes/manager.js.map +1 -1
- package/dist/classes/reserve.d.ts +3 -0
- package/dist/classes/reserve.d.ts.map +1 -1
- package/dist/classes/reserve.js +323 -230
- package/dist/classes/reserve.js.map +1 -1
- package/dist/classes/utils.d.ts +5 -0
- package/dist/classes/utils.d.ts.map +1 -1
- package/dist/classes/utils.js +13 -0
- package/dist/classes/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/classes/manager.ts +109 -52
- package/src/classes/reserve.ts +442 -279
- package/src/classes/utils.ts +13 -0
package/src/classes/utils.ts
CHANGED
|
@@ -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
|
+
}
|