import { AccountInfo, Connection, PublicKey } from '@solana/web3.js';
import { KaminoObligation } from './obligation';
import { KaminoReserve } from './reserve';
import { LendingMarket, UserMetadata, ReferrerTokenState } from '../idl_codegen/accounts';
import { ObligationType, PubkeyHashMap, PublicKeySet } from '../utils';
import Decimal from 'decimal.js';
import { OraclePrices, Scope } from '@kamino-finance/scope-sdk';
import { KaminoPrices } from '@kamino-finance/kliquidity-sdk';
export interface ReserveRewardInfo {
    rewardsPerSecond: Decimal;
    rewardsRemaining: Decimal;
    rewardApr: Decimal;
    rewardMint: PublicKey;
    totalInvestmentUsd: Decimal;
    rewardPrice: number;
}
export declare class KaminoMarket {
    private readonly connection;
    readonly address: string;
    state: LendingMarket;
    reserves: Map<PublicKey, KaminoReserve>;
    reservesActive: Map<PublicKey, KaminoReserve>;
    readonly programId: PublicKey;
    private readonly recentSlotDurationMs;
    private constructor();
    /**
     * Load a new market with all of its associated reserves
     * @param connection
     * @param marketAddress
     * @param recentSlotDurationMs
     * @param programId
     * @param withReserves
     * @param setupLocalTest
     * @param withReserves
     */
    static load(connection: Connection, marketAddress: PublicKey, recentSlotDurationMs: number, programId?: PublicKey, withReserves?: boolean): Promise<KaminoMarket | null>;
    static loadWithReserves(connection: Connection, market: LendingMarket, reserves: Map<PublicKey, KaminoReserve>, marketAddress: PublicKey, recentSlotDurationMs: number, programId?: PublicKey): KaminoMarket;
    reload(): Promise<void>;
    reloadSingleReserve(reservePk: PublicKey, accountData?: AccountInfo<Buffer>): Promise<void>;
    /**
     * Get the address of this market
     * @return market address public key
     */
    getAddress(): PublicKey;
    /**
     * Get a list of reserves for this market
     */
    getReserves(): Array<KaminoReserve>;
    getElevationGroup(elevationGroup: number): import("../idl_codegen/types").ElevationGroup;
    /**
     * Returns this market's elevation group of the given ID, or `null` for the default group `0`, or throws an error
     * (including the given description) if the requested group does not exist.
     */
    getExistingElevationGroup(elevationGroupId: number, description?: string): ElevationGroupDescription | null;
    getMinNetValueObligation(): Decimal;
    /**
     * Get the authority PDA of this market
     * @return market authority public key
     */
    getLendingMarketAuthority(): PublicKey;
    getName(): string;
    getObligationDepositByWallet(owner: PublicKey, mint: PublicKey, obligationType: ObligationType): Promise<Decimal>;
    getObligationBorrowByWallet(owner: PublicKey, mint: PublicKey, obligationType: ObligationType): Promise<Decimal>;
    getTotalDepositTVL(): Decimal;
    getTotalBorrowTVL(): Decimal;
    getMaxLeverageForPair(collTokenMint: PublicKey, debtTokenMint: PublicKey): number;
    getCommonElevationGroupsForPair(collReserve: KaminoReserve, debtReserve: KaminoReserve): number[];
    getMaxAndLiquidationLtvAndBorrowFactorForPair(collTokenMint: PublicKey, debtTokenMint: PublicKey): {
        maxLtv: number;
        liquidationLtv: number;
        borrowFactor: number;
    };
    getTotalProductTvl(productType: ObligationType): Promise<{
        tvl: Decimal;
        borrows: Decimal;
        deposits: Decimal;
        avgLeverage: Decimal;
    }>;
    /**
     *
     * @returns Number of active obligations in the market
     */
    getNumberOfObligations(): Promise<number>;
    getObligationByWallet(publicKey: PublicKey, obligationType: ObligationType): Promise<KaminoObligation | null>;
    /**
     * @returns The max borrowable amount for leverage positions
     */
    getMaxLeverageBorrowableAmount(collReserve: KaminoReserve, debtReserve: KaminoReserve, slot: number, requestElevationGroup: boolean, obligation?: KaminoObligation): Promise<Decimal>;
    loadReserves(): Promise<void>;
    refreshAll(): Promise<void>;
    getReserveByAddress(address: PublicKey): KaminoReserve | undefined;
    /**
     * Returns this market's reserve of the given address, or throws an error (including the given description) if such
     * reserve does not exist.
     */
    getExistingReserveByAddress(address: PublicKey, description?: string): KaminoReserve;
    getReserveByMint(address: PublicKey): KaminoReserve | undefined;
    /**
     * Returns this market's reserve of the given mint address, or throws an error (including the given description) if
     * such reserve does not exist.
     */
    getExistingReserveByMint(address: PublicKey, description?: string): KaminoReserve;
    getReserveBySymbol(symbol: string): KaminoReserve | undefined;
    /**
     * Returns this market's reserve of the given symbol, or throws an error (including the given description) if
     * such reserve does not exist.
     */
    getExistingReserveBySymbol(symbol: string, description?: string): KaminoReserve;
    getReserveMintBySymbol(symbol: string): PublicKey | undefined;
    getReserveFarmInfo(mint: PublicKey, getRewardPrice: (mint: PublicKey) => Promise<number>): Promise<{
        borrowingRewards: ReserveRewardInfo;
        depositingRewards: ReserveRewardInfo;
    }>;
    getRewardInfoForFarm(farmAddress: PublicKey, totalInvestmentUsd: Decimal, getRewardPrice: (mint: PublicKey) => Promise<number>): Promise<ReserveRewardInfo>;
    calculateRewardAPR(rewardPerSecondLamports: number, rewardPriceUsd: number, totalInvestmentUsd: Decimal, rewardDecimals: number): Decimal;
    /**
     * Get all obligations for lending market, optionally filter by obligation tag
     * This function will likely require an RPC capable of returning more than the default 100k rows in a single scan
     *
     * @param tag
     */
    getAllObligationsForMarket(tag?: number): Promise<KaminoObligation[]>;
    /**
     * Get all obligations for lending market from an async generator filled with batches of 100 obligations each
     * @param tag
     * @example
     * const obligationsGenerator = market.batchGetAllObligationsForMarket();
     * for await (const obligations of obligationsGenerator) {
     *   console.log('got a batch of # obligations:', obligations.length);
     * }
     */
    batchGetAllObligationsForMarket(tag?: number): AsyncGenerator<KaminoObligation[], void, unknown>;
    getAllObligationsByTag(tag: number, market: PublicKey): Promise<KaminoObligation[]>;
    getAllObligationsByDepositedReserve(reserve: PublicKey): Promise<KaminoObligation[]>;
    getAllUserObligations(user: PublicKey, commitment?: import("@solana/web3.js").Commitment | undefined): Promise<KaminoObligation[]>;
    getAllUserObligationsForReserve(user: PublicKey, reserve: PublicKey): Promise<KaminoObligation[]>;
    getUserVanillaObligation(user: PublicKey): Promise<KaminoObligation>;
    isReserveInObligation(obligation: KaminoObligation, reserve: PublicKey): boolean;
    getUserObligationsByTag(tag: number, user: PublicKey): Promise<KaminoObligation[]>;
    getObligationByAddress(address: PublicKey): Promise<KaminoObligation | null>;
    getMultipleObligationsByAddress(addresses: PublicKey[]): Promise<(KaminoObligation | null)[]>;
    /**
     * Get the user metadata PDA and fetch and return the user metadata state if it exists
     * @return [address, userMetadataState] - The address of the user metadata PDA and the user metadata state, or null if it doesn't exist
     */
    getUserMetadata(user: PublicKey): Promise<[PublicKey, UserMetadata | null]>;
    getReferrerTokenStateForReserve(referrer: PublicKey, reserve: PublicKey): Promise<[PublicKey, ReferrerTokenState | null]>;
    getAllReferrerTokenStates(referrer: PublicKey): Promise<PubkeyHashMap<PublicKey, ReferrerTokenState>>;
    getAllReferrerFeesUnclaimed(referrer: PublicKey): Promise<PubkeyHashMap<PublicKey, Decimal>>;
    getReferrerFeesUnclaimedForReserve(referrer: PublicKey, reserve: KaminoReserve): Promise<Decimal>;
    getReferrerFeesCumulativeForReserve(referrer: PublicKey, reserve: KaminoReserve): Promise<Decimal>;
    getAllReferrerFeesCumulative(referrer: PublicKey): Promise<PubkeyHashMap<PublicKey, Decimal>>;
    getReferrerUrl(baseUrl: string, referrer: PublicKey): Promise<string>;
    getReferrerFromUrl(baseUrl: string, url: string): Promise<PublicKey>;
    encodeReferrer(referrer: PublicKey): Promise<string>;
    decodeReferrer(encoded_referrer: string): Promise<PublicKey>;
    /**
     * Get the underlying connection passed when instantiating this market
     * @return connection
     */
    getConnection(): Connection;
    /**
     * Get all Scope prices used by all the market reserves
     */
    getAllScopePrices(scope: Scope, oraclePrices?: OraclePrices): Promise<KaminoPrices>;
    /**
     * Get all Scope/Pyth/Switchboard prices used by all the market reserves
     */
    getAllPrices(): Promise<KlendPrices>;
    getCumulativeBorrowRatesByReserve(slot: number): Map<PublicKey, Decimal>;
    getCollateralExchangeRatesByReserve(slot: number): Map<PublicKey, Decimal>;
    private setPriceIfExist;
    getRecentSlotDurationMs(): number;
    getMarketElevationGroupDescriptions(): ElevationGroupDescription[];
    getElevationGroupsForMintsCombination(collLiquidityMints: PublicKey[], debtLiquidityMint?: PublicKey): ElevationGroupDescription[];
    getElevationGroupsForReservesCombination(collReserves: PublicKey[], debtReserve?: PublicKey): ElevationGroupDescription[];
}
export type BorrowCapsAndCounters = {
    utilizationCap: Decimal;
    utilizationCurrentValue: Decimal;
    netWithdrawalCap: Decimal;
    netWithdrawalCurrentValue: Decimal;
    netWithdrawalLastUpdateTs: Decimal;
    netWithdrawalIntervalDurationSeconds: Decimal;
    globalDebtCap: Decimal;
    globalTotalBorrowed: Decimal;
    debtOutsideEmodeCap: Decimal;
    borrowedOutsideEmode: Decimal;
    debtAgainstCollateralReserveCaps: {
        collateralReserve: PublicKey;
        elevationGroup: number;
        maxDebt: Decimal;
        currentValue: Decimal;
    }[];
};
export type ElevationGroupDescription = {
    collateralReserves: PublicKeySet<PublicKey>;
    collateralLiquidityMints: PublicKeySet<PublicKey>;
    debtReserve: PublicKey;
    debtLiquidityMint: PublicKey;
    elevationGroup: number;
    maxReservesAsCollateral: number;
};
export type KlendPrices = {
    scope: KaminoPrices;
    pyth: KaminoPrices;
    switchboard: KaminoPrices;
};
export declare function getReservesForMarket(marketAddress: PublicKey, connection: Connection, programId: PublicKey, recentSlotDurationMs: number): Promise<Map<PublicKey, KaminoReserve>>;
export declare function getSingleReserve(reservePk: PublicKey, connection: Connection, recentSlotDurationMs: number, accountData?: AccountInfo<Buffer>): Promise<KaminoReserve>;
export declare function getReservesActive(reserves: Map<PublicKey, KaminoReserve>): Map<PublicKey, KaminoReserve>;
export declare function getTokenIdsForScopeRefresh(kaminoMarket: KaminoMarket, reserves: PublicKey[]): number[];
export declare function getReserveFromMintAndMarket(connection: Connection, market: KaminoMarket, mint: string, programId?: PublicKey): Promise<[PublicKey, AccountInfo<Buffer>]>;
//# sourceMappingURL=market.d.ts.map