UNPKG

@kamino-finance/klend-sdk

Version:

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

56 lines 2.72 kB
import { Account, Address, Base64EncodedDataResponse, GetMultipleAccountsApi, Rpc } from '@solana/kit'; import Decimal from 'decimal.js'; import { Scope } from '@kamino-finance/scope-sdk'; import { OraclePrices } from '@kamino-finance/scope-sdk/dist/@codegen/scope/accounts/OraclePrices'; import { ReserveWithAddress } from '../classes'; import { Reserve } from '../lib'; import { Configuration } from '@kamino-finance/scope-sdk/dist/@codegen/scope/accounts/Configuration'; export declare const MAX_CONFIDENCE_PERCENTAGE: Decimal; export declare const CONFIDENCE_FACTOR: Decimal; export type TokenOracleData = { mintAddress: Address; decimals: Decimal; price: Decimal; timestamp: bigint; valid: boolean; }; export type CandidatePrice = { price: Decimal; timestamp: bigint; valid: boolean; }; export type ScopePriceRefreshConfig = { scope: Scope; scopeConfigurations: [Address, Configuration][]; }; export declare function getTokenOracleDataSync(allOracleAccounts: AllOracleAccounts, reserves: ReserveWithAddress[]): [Reserve, TokenOracleData | undefined][]; export declare function getTokenOracleData(rpc: Rpc<GetMultipleAccountsApi>, reserves: ReserveWithAddress[], oracleAccounts?: AllOracleAccounts): Promise<Array<[Reserve, TokenOracleData | undefined]>>; export type AllOracleAccounts = Map<Address, Account<Base64EncodedDataResponse>>; export declare function getAllOracleAccounts(rpc: Rpc<GetMultipleAccountsApi>, 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: Address, cache: Map<Address, 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 */ export declare function cacheOrGetSwitchboardPrice(oracle: Address, switchboardCache: Map<Address, CandidatePrice>, oracleAccounts: AllOracleAccounts): 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: Address, scopeCache: Map<Address, OraclePrices>, allOracleAccounts: AllOracleAccounts, chain: number[]): CandidatePrice | null; //# sourceMappingURL=oracle.d.ts.map