UNPKG

@kamino-finance/klend-sdk

Version:

Typescript SDK for interacting with the Kamino Lending (klend) protocol

47 lines 2.38 kB
import Decimal from 'decimal.js'; import { AccountInfo, PublicKey } from '@solana/web3.js'; type ObligationFarmScoreType = { obligationId: string; balance: string; debt: string; score: string; lastSlot: number; tokenMint: string; side: 'supply' | 'borrow'; }; type RewardRate = { beginningSlot: number; rewardRate: string; name?: string; }; export declare const calculateNewScore: (rewardStat: { lastSlot: number; rewardRates: Array<RewardRate>; rewardsPerShare: string; totalBalance: string; }, pool: ObligationFarmScoreType, rewardRate: string, endSlot: number, startSlot: number) => Decimal; export declare const estimateCurrentScore: (rewardStat: { lastSlot: number; rewardRates: Array<RewardRate>; rewardsPerShare: string; totalBalance: string; }, rewardScore: ObligationFarmScoreType, mostRecentSlot: number, mostRecentSlotTime: number) => Decimal; export declare const interpolate: (x: number, x0: number, x1: number, y0: number, y1: number) => number; export declare const getBorrowRate: (currentUtilization: number, curve: [number, number][]) => number; export declare const parseTokenSymbol: (tokenSymbol: number[]) => string; export declare function parseZeroPaddedUtf8(utf8Array: number[]): string; export declare function renderZeroPaddedUtf8(str: string, utf8ArrayLength: number): number[]; export declare function sleep(ms: number): Promise<unknown>; export declare function numberToLamportsDecimal(amount: Decimal.Value, decimals: number): Decimal; export declare function lamportsToNumberDecimal(amount: Decimal.Value, decimals: number): Decimal; export declare function lamportsToDecimal(amount: Decimal.Value, decimals: Decimal.Value): Decimal; export declare const isSolMint: (mint: PublicKey) => boolean; export declare const valueOrZero: (value: Decimal) => Decimal; export declare const isEmptyObject: (obj: any) => boolean; export declare const positiveOrZero: (value: Decimal) => Decimal; export declare function calculateAPYFromAPR(apr: number): number; export declare function calculateAPRFromAPY(apy: Decimal.Value): Decimal; export declare function sameLengthArrayEquals(left: Array<number>, right: Array<number>): boolean; export declare function getTokenBalanceFromAccountInfoLamports(accountInfo: AccountInfo<Buffer>): Decimal; export {}; //# sourceMappingURL=utils.d.ts.map