UNPKG

@kamino-finance/klend-sdk

Version:

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

55 lines 2.39 kB
import { AccountInfo, Connection, PublicKey } from '@solana/web3.js'; import Decimal from 'decimal.js'; import { OraclePrices } from '@kamino-finance/scope-sdk'; import { PubkeyHashMap } from './pubkey'; import SwitchboardProgram from '@switchboard-xyz/sbv2-lite'; import { Reserve } from '../lib'; export declare const MAX_CONFIDENCE_PERCENTAGE: Decimal; export declare const CONFIDENCE_FACTOR: Decimal; export type TokenOracleData = { mintAddress: PublicKey; decimals: Decimal; price: Decimal; timestamp: bigint; valid: boolean; }; export type CandidatePrice = { price: Decimal; timestamp: bigint; valid: boolean; }; export type ScopeRefresh = { includeScopeRefresh: boolean; scopeFeed: string; }; export declare function getTokenOracleData(connection: Connection, reserves: Reserve[]): Promise<Array<[Reserve, TokenOracleData | undefined]>>; export type AllOracleAccounts = PubkeyHashMap<PublicKey, AccountInfo<Buffer>>; export declare function getAllOracleAccounts(connection: Connection, reserves: Reserve[]): Promise<AllOracleAccounts>; export type PythPrices = { spot?: CandidatePrice; twap?: CandidatePrice; }; /** * Get pyth price from cache or fetch if not available * @param oracle oracle address * @param cache pyth cache * @param oracleAccounts all oracle accounts */ export declare function cacheOrGetPythPrices(oracle: PublicKey, cache: Map<PublicKey, PythPrices>, oracleAccounts: AllOracleAccounts): PythPrices | null; /** * Get switchboard price from cache or fetch if not available * @param oracle oracle address * @param switchboardCache cache for oracle prices * @param oracleAccounts all oracle accounts * @param switchboardV2 loaded switchboard program */ export declare function cacheOrGetSwitchboardPrice(oracle: PublicKey, switchboardCache: Map<PublicKey, CandidatePrice>, oracleAccounts: AllOracleAccounts, switchboardV2: SwitchboardProgram): CandidatePrice | null; /** * Get scope price from cache or fetch if not available * @param oracle oracle address * @param scopeCache cache for oracle prices * @param allOracleAccounts all oracle accounts * @param chain scope chain */ export declare function cacheOrGetScopePrice(oracle: PublicKey, scopeCache: Map<PublicKey, OraclePrices>, allOracleAccounts: AllOracleAccounts, chain: number[]): CandidatePrice | null; //# sourceMappingURL=oracle.d.ts.map